koha.git
6 years agoBug 20261: Fix pagination of the results in authority search
Alex Arnaud [Wed, 28 Mar 2018 09:03:56 +0000]
Bug 20261: Fix pagination of the results in authority search

Test plan:

  - apply this patch,
  - do a search that return more than 20 results,
  - click on page 2,
  - check that you get results,
  - check other pages if possible

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 17373: Add mappings for unimarc authorities - Match index
Alex Arnaud [Mon, 12 Mar 2018 16:12:20 +0000]
Bug 17373: Add mappings for unimarc authorities - Match index

Test plan:

1. apply patches

2. switch  SearchEngine syspref to ElasticSearch

3. load new mapping
(admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1)

4. load some unimarc authorities like the sample attached to bug 17373

5. reindex authorities
(./misc/search_tools/rebuild_elastic_search.pl -d -a -v)

6. search entire notice for shalev or שלו

7. you should find stuff

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 17373: Elasticsearch - Authority mappings for UNIMARC - patch1
Fridolin Somers [Thu, 13 Oct 2016 07:45:40 +0000]
Bug 17373: Elasticsearch - Authority mappings for UNIMARC - patch1

This patch starts the UNIMARC mapping for ES.
It is needed to test.
More patches will come.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20325: Remove warning, it is no longer true
Kyle M Hall [Thu, 5 Apr 2018 10:12:44 +0000]
Bug 20325: Remove warning, it is no longer true

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20325: Do not remove accountlines between tests
Jonathan Druart [Wed, 4 Apr 2018 18:36:46 +0000]
Bug 20325: Do not remove accountlines between tests

This is part of the tests, to make sure they have not been deleted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20325: Move tests to a subtest
Jonathan Druart [Wed, 4 Apr 2018 18:19:54 +0000]
Bug 20325: Move tests to a subtest

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20325: C4::Accounts::purge_zero_balance_fees does not check account_offsets
Kyle M Hall [Tue, 27 Mar 2018 19:16:16 +0000]
Bug 20325: C4::Accounts::purge_zero_balance_fees does not check account_offsets

purge_zero_balance_fees is used in cleanup_database.pl to determine which fees can be cleaned up.

It uses a simple SQL query to determine which rows in accountlines need to be removed:

463     my $sth = $dbh->prepare(
464         q{
465             DELETE FROM accountlines
466             WHERE date < date_sub(curdate(), INTERVAL ? DAY)
467               AND ( amountoutstanding = 0 or amountoutstanding IS NULL );
468         }

The function comes with the following warning:

451 B<Warning:> Because fines and payments are not linked in accountlines, it is
452 possible for a fine to be deleted without the accompanying payment,
453 or vise versa. This won't affect the account balance, but might be
454 confusing to staff.

This was a reasonable solution prior to the addition of account_offsets in 17.11. The problem now is that rows in accountlines which are linked as credits in accountlines will *always* have amountoutstanding marked as 0. These are linked to debits via account_offsets. purge_zero_balance_fees will delete credits and leave rows in account_offsets which link to deleted credits.

Sites using the --fees option cleanup_database.pl which upgrade to 17.11 may have all of their credits removed without warning.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Accounts.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20191: (QA follow-up) Require Jessie's Test::MockTime
Tomas Cohen Arazi [Thu, 5 Apr 2018 13:06:37 +0000]
Bug 20191: (QA follow-up) Require Jessie's Test::MockTime

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20191: Use Test::MockTime to hold time still
Mark Tompsett [Thu, 5 Apr 2018 01:31:38 +0000]
Bug 20191: Use Test::MockTime to hold time still

The problem is the calls to HTTP::OAI::Header, etc.
may reference gmtime which is continually changing by
the second. By forcing time to lock for all the tests,
except the last one, we can be assured things should
not fail.

TEST PLAN
---------
install libtest-mocktime-perl
apply the patch
restart_all
in kshell, prove t/db_dependent/OAI/Server.t
run koha qa test tools

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19953: Record page: acquisition details: add column for invoice
Victor Grousset [Fri, 5 Jan 2018 14:03:38 +0000]
Bug 19953: Record page: acquisition details: add column for invoice

Test plan:
1. create a vendor with minimal info
2. create a basket with minimal info
3. add a item to the basket
4. close the basket
5. receive a shipment
6. on the "receipt summary" click on "receive" for the wanted item (it
   should be the only one)
7. items → receive? → tick this checkbox
8. save
9. click on "finish receiving"
10. go to the record → Acquisition details
11. apply this patch
12. refresh the page
13. you should see the new column

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19267: Rancor - Warn before leaving page if record modified
Jesse Weaver [Mon, 18 Jul 2016 22:31:20 +0000]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19812: Fix confusing holds count values in "Already received" table
Kyle M Hall [Thu, 14 Dec 2017 12:03:39 +0000]
Bug 19812: Fix confusing holds count values in "Already received" table

In acqui/parcel.pl both the "Pending orders" and "Already received" tables show how many holds there are for the given record. However, the count of holds in the "Pending orders" table confuses librarians because it only lists holds for the particular items in the orderline. Due to that, the holds column may show 0 holds even if there are a dozen record level holds for that bib! This is not what librarians seem to expect, instead it seems that the same total holds in the "Pending orders" table would be preferred.

Test Plan:
1) Find an invoice with an item in the "Already received" table
2) Add one or more record level holds to the record
3) Note the holds column does not count those holds
4) Apply this patch
5) Note the holds column now shows total holds and holds for just those ordered items

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nancy Keener <nkeener@washoecounty.us>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 19812: (QA follow-up) Swap sides for total and item holds

Bug 19812: (QA follow-up) If 0 holds show '0' not '0 / 0'

Bug 19812: (QA follow-up) Remove unnecessary line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19910: Use span to make translators happy
Jonathan Druart [Wed, 4 Apr 2018 18:54:58 +0000]
Bug 19910: Use span to make translators happy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19910: Use the delimiter syspref to name download link
Nick Clemens [Wed, 3 Jan 2018 14:07:17 +0000]
Bug 19910: Use the delimiter syspref to name download link

To test:
1 - Set delimiter syspref to anything but comma
2 - Download report results as comma separated text
3 - They actually follow the syspref
4 - Apply patch
5 - Download link should now match pref selection
6 - Change pref, note link changes
7 - Verify things still work as expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20008: Fix restrictions added from memberentry.pl if TimeFormat is 12hr
Kyle M Hall [Wed, 17 Jan 2018 19:30:06 +0000]
Bug 20008: Fix restrictions added from memberentry.pl if TimeFormat is 12hr

Test Plan:
1) Set TimeFormat to 12 hour
2) Add a restriction with an expiration date via memberentry.pl
3) Note the restriction exists, but has no expiration date
4) Apply this patch
5) Repeat step 2
6) Note the restriction exists and has an expiration date!

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20115: Add information about this feature in the pref descriptions
Jonathan Druart [Thu, 29 Mar 2018 15:14:11 +0000]
Bug 20115: Add information about this feature in the pref descriptions

I guess a native English speaker will have a better wording :)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20115: Remove sort on rfc4646_subtag in OPAC templates
Jonathan Druart [Thu, 15 Feb 2018 14:42:22 +0000]
Bug 20115: Remove sort on rfc4646_subtag in OPAC templates

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20115: Trigger "modified" when sort is changed
Jonathan Druart [Wed, 31 Jan 2018 17:06:23 +0000]
Bug 20115: Trigger "modified" when sort is changed

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20115: Make the prefs sortable
Jonathan Druart [Wed, 31 Jan 2018 16:47:46 +0000]
Bug 20115: Make the prefs sortable

If we depend on the order, we should make it sortable.

I let the customization to someone else (we would need an icon to tell
the user it's sortable).

Something does not work here:
If fr-FR and fr-CA is installed, but only 1 is ticked, it will be
considered as last. I do not think it's a blocker as it does not make
really make sense to have it installed but not used (the interface is
also weird, there is a dropdown list with only 1 entry)

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20115: Set the languages order with the pref values
Jonathan Druart [Wed, 31 Jan 2018 16:47:37 +0000]
Bug 20115: Set the languages order with the pref values

To avoid the languages to be ordered randomly, it is better to stick on
a default order.
Let's suppose that the order in the pref is correct.

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19578: Remove MARC punctuation in notices (TT syntax)
Jonathan Druart [Mon, 6 Nov 2017 18:35:50 +0000]
Bug 19578: Remove MARC punctuation in notices (TT syntax)

Jenkins fails (run 287) on a test in t/db_dependent/Letters/TemplateToolkit.t:

With the historical syntax:
        # Your request for an article from tQYRS (c3Av58O0P5xkkIGu) has been canceled for the following reason:

With the TT syntax:
        # Your request for an article from tQYRS_ (c3Av58O0P5xkkIGu) has been canceled for the following reason:

The last character of the biblio's title has been removed because it's a punctuation character.
It comes from: C4::Letters::_parseletter
 893         $val =~ s/\p{P}$// if $val && $table=~/biblio/;

The same replacement is done for patron's attributes too.

Test plan:
- Confirm that the new tests pass. That should be enough to confirm this change make sense.

Test plan (manual):
- Create a biblio with a title ending with a punctuation (like "with_punctuation_"), or any other fields of biblio/biblioitem
- Generate a notice which will display this field (CHECKIN for instance)

Use the historical syntax and the TT syntax, both should display the title without the punctuation character at the end

CHECKIN historical:
The following items have been checked in:
----
<<biblio.title>>
----

CHECKIN TT syntax:
The following items have been checked in:
----
[% biblio.title %]
----

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20083: (follow-up) use same logic in opac-showmarc
Mark Tompsett [Tue, 30 Jan 2018 22:35:39 +0000]
Bug 20083: (follow-up) use same logic in opac-showmarc

It was correctly pointed out that opac-showmarc would leak
the same way as catalogue/showmarc.pl, and so this patch
moves the authentication step up to the top where it
should be so as to prevent inappropriate data leaks.

TEST PLAN
---------
1) Set your OpacPublic system preference to Disabled
2) Open your OPAC and login
3) Find a biblio with items
4) Go to the opac details, particularly MARC view.
5) Copy the "view plain" shortcut link.
6) log out.
7) Paste the link into the address bar.
   -- the information will leak!
8) apply the patch
9) restart_all
10) Refresh the OPAC link
    -- log in screen will appear.
11) run koha qa test tools

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20083: Information disclosure when (mis)using the MARC Preview feature
Andreas Roussos [Fri, 26 Jan 2018 01:12:47 +0000]
Bug 20083: Information disclosure when (mis)using the MARC Preview feature

The MARC Preview feature in the Staff client (catalogue/showmarc.pl) does not
check whether a user is logged in or not. As a consequence, it can be used to
obtain information that would normally be available to logged-in users only.
For example, you can view any bibliographic record by passing a value to the
'id' argument, but you can also view records as they were imported (normally
done via the 'Staged MARC management' tool).

All three 17.11 installations currently listed at
https://wiki.koha-community.org/wiki/Koha_Demo_Installations
are affected by this issue, as demonstrated by the URLs below:

http://koha.adminkuhn.ch:8080/cgi-bin/koha/catalogue/showmarc.pl?importid=1&viewas=html
http://pro.demo1711-koha.test.biblibre.eu/cgi-bin/koha/catalogue/showmarc.pl?id=1000&viewas=html
https://staff-kohademo.equinoxinitiative.org/cgi-bin/koha/catalogue/showmarc.pl?id=1&viewas=html

It should be noted that this only applies to XSLT-enabled installations.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19223: Add methods to correctly handle plugin-generated output
Tomas Cohen Arazi [Tue, 27 Mar 2018 18:56:57 +0000]
Bug 19223: Add methods to correctly handle plugin-generated output

This patch introduces two methods to be used by plugin authors:

->output
->output_html

They are basically wrappers for the helper methods from C4::Output
(output_html_with_http_headers and output_with_http_headers).

Plugin authors can use them, or keep the current flexibility of handling
the headers themselves in their code.

The KitchenSink plugin should be updated to highlight this.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Plugins.t
=> FAIL: The methods are not implemented
- Apply this patch
- Run:
 k$ prove t/db_dependent/Plugins.t
=> SUCCESS: Tests pass, and they are meaningful
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19223: Unit tests for output and output_html methods
Tomas Cohen Arazi [Tue, 27 Mar 2018 18:56:41 +0000]
Bug 19223: Unit tests for output and output_html methods

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: (follow-up) Replace GetPendingIssues - opac-user.pl
Jonathan Druart [Tue, 3 Apr 2018 12:52:57 +0000]
Bug 19935: (follow-up) Replace GetPendingIssues - opac-user.pl

Syntax issue, can be squashed on pushing.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Use ->checkouts when ->pending_checkouts->count was used
Jonathan Druart [Tue, 3 Apr 2018 12:49:54 +0000]
Bug 19935: Use ->checkouts when ->pending_checkouts->count was used

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - Remove the residue
Jonathan Druart [Mon, 8 Jan 2018 15:32:55 +0000]
Bug 19935: Replace GetPendingIssues - Remove the residue

Here we are, no more occurrences of GetPendingIssues, we can remove the
tests and subroutine \o/

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - SIP
Jonathan Druart [Mon, 8 Jan 2018 15:23:42 +0000]
Bug 19935: Replace GetPendingIssues - SIP

Sounds like we do not need related fields or 'overdue' flag here.
No idea how to confirm there is no regression here.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - sco-main
Jonathan Druart [Mon, 8 Jan 2018 15:06:59 +0000]
Bug 19935: Replace GetPendingIssues - sco-main

Same as previously, we do not need all the prefetched values here, just
a few.

Test plan:
Use the self checkout module to check some items out

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - opac-user.pl
Jonathan Druart [Mon, 8 Jan 2018 14:59:29 +0000]
Bug 19935: Replace GetPendingIssues - opac-user.pl

At first glance we just need the biblio title and the subtitle (in
addition of the fines info), we should not need the prefetch.

Test plan:
Loggin at the OPAC, on the summary page you should see your checkouts
and overdues with the correct values

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - opac-ics.pl
Jonathan Druart [Mon, 8 Jan 2018 14:47:46 +0000]
Bug 19935: Replace GetPendingIssues - opac-ics.pl

We only need the biblio title and the barcode, we should not need the
whole prefetch.

Test plan:
On your OPAC summary page export your checkout list using the
"Download as iCal/.ics file" link.
Before and after the patchset, the generated files must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - summary-print
Jonathan Druart [Mon, 8 Jan 2018 14:40:10 +0000]
Bug 19935: Replace GetPendingIssues - summary-print

We are in the notices part, so we need to fetch all the data to avoid
regressions.

Test plan:
Print a summary slip before and after this patch.
They must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - deletemem.pl
Jonathan Druart [Mon, 8 Jan 2018 14:16:09 +0000]
Bug 19935: Replace GetPendingIssues - deletemem.pl

Same as previously, we just want Koha::Patron->checkouts->count to know
if a patron has checkouts.

Test plan:
Confirm that you cannot delete a patron's card if they have pending checkouts

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - Discharges
Jonathan Druart [Mon, 8 Jan 2018 14:15:02 +0000]
Bug 19935: Replace GetPendingIssues - Discharges

We should actually use Koha::Patron->checkouts here to avoid the
prefetch.

Test plan:
A patron with checkouts cannot get a discharge

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - ILSDI
Jonathan Druart [Mon, 8 Jan 2018 14:10:50 +0000]
Bug 19935: Replace GetPendingIssues - ILSDI

Here we should only access to what we want in the template, but let do
it as it for now.

Test plan:
Hit
/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=542&show_contact=0&show_loans=1

With 42 a borrowernumber with checkouts

Before and after these patches the XML must be the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Replace GetPendingIssues - IssueSlip
Jonathan Druart [Mon, 8 Jan 2018 18:49:18 +0000]
Bug 19935: Replace GetPendingIssues - IssueSlip

Luckily we have a good test coverage here!

Test plan:
Print issue slips before and after these patches (with overdues, etc.)
They should be the same.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19935: Add Koha::Patron->pending_checkouts
Jonathan Druart [Mon, 8 Jan 2018 18:49:03 +0000]
Bug 19935: Add Koha::Patron->pending_checkouts

To move this subroutine out of the C4 namespace we face the same
problematic as bug 17553 (with GetOverduesForPatron).
We need to provide an equivalent method and so return all the related
value for a given checkout.
We can acchieve the easily using Koha::Object->unblessed_all_relateds,
but we need to keep in mind that it is a temporary move.
Indeed we will want to use our API to only access/retrive values we really need.
The whole trick could be removed when the current syntax for notices
will be deprecated and removed.

Note: this method returns the same number of elements than ->checkouts
They indeed returns the same things, but it sounds better to me to have a
different method to highlight (from the callers) where does it come
from (C4::Members::GetPendingIssues).

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 17553: (follow-up) Adjust number of tests
Josef Moravec [Tue, 3 Apr 2018 12:28:21 +0000]
Bug 17553: (follow-up) Adjust number of tests

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 17553: Move GetOverduesForPatron to Koha::Patron->get_overdues
Jonathan Druart [Mon, 8 Jan 2018 16:19:51 +0000]
Bug 17553: Move GetOverduesForPatron to Koha::Patron->get_overdues

With the help of Koha::Object->unblessed_all_relateds we are going to
replace GetOverduesForPatron without introducing regressions (hopefully)
on both template notice syntaxes.

Test plan:
0/ Do not apply any patches
1/ Check some items in to a given patron, with and without overdues.
2/ Print the overdues slip (Circulation module > Print > Print overdues)
3/ Apply these patches
4/ Print again and compare the result
=> The 2 generated slips must be exactly the same

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 17553: Move existing tests
Jonathan Druart [Fri, 4 Nov 2016 10:23:56 +0000]
Bug 17553: Move existing tests

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19926: Add tests for Koha::Object->unblessed_all_relateds
Jonathan Druart [Mon, 8 Jan 2018 16:48:28 +0000]
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19926: Add the Koha::Object->unblessed_all_relateds method
Jonathan Druart [Mon, 8 Jan 2018 16:19:16 +0000]
Bug 19926: Add the Koha::Object->unblessed_all_relateds method

In order to refactor our legacy code step-by-step, we will need to
provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to
deprecate the existing syntax in order to support only one syntax.
Currently we fetch all the values from the related tables, without
knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds
method which will return a hash containing all the fields from the
related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues
for instance, they are used to send notices and so we have to provide
all the data needed.

See dependent bugs to understand the context and test this patch.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 7143: Update about page for new dev - Roch D'Amour
Jonathan Druart [Tue, 3 Apr 2018 14:21:28 +0000]
Bug 7143: Update about page for new dev - Roch D'Amour

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 7143: Update about page for new dev - Philippe Audet-Fortin
Jonathan Druart [Tue, 3 Apr 2018 14:18:08 +0000]
Bug 7143: Update about page for new dev - Philippe Audet-Fortin

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 7143: Update about page for new releases
Jonathan Druart [Tue, 3 Apr 2018 14:16:53 +0000]
Bug 7143: Update about page for new releases

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18820: Main block size now adjust to OpacNavRight like it would for opacuserlogin
Roch D'Amour [Thu, 22 Feb 2018 21:08:59 +0000]
Bug 18820: Main block size now adjust to OpacNavRight like it would for opacuserlogin

Test plans  :
- "beforepatch.png" shows the result you get when OpacNavRight and opacnav are set to false.
- "opacuserlogin=f_opacnav=f.png" shows the result with the patch and OpacNavRight and opacnav set to false
- "opacuserlogin=t_opacnav=f.png" shows the result with the patch and OpacNavRight set to true and opacnav set to false

Applied patch, can confirm it functions as expected.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18820: Adding lines that check if opacuserlogin is enable and if OpacNav has...
Paudet [Mon, 19 Jun 2017 13:27:15 +0000]
Bug 18820: Adding lines that check if opacuserlogin is enable and if OpacNav has content.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Dominic Pichette <dominic@inlibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20497: Access LibraryThing assets using HTTPS
Tomas Cohen Arazi [Thu, 29 Mar 2018 19:12:28 +0000]
Bug 20497: Access LibraryThing assets using HTTPS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19892: (follow-up) Replace one more instance
Owen Leonard [Tue, 27 Mar 2018 16:46:16 +0000]
Bug 19892: (follow-up) Replace one more instance

This patch replaces one more instance of [% IF ( numbersphr ) %].

To test, apply the patch and view the source of the OPAC home page.

With the OPACNumbersPreferPhrase system preference set to 'use,' you
should find this in the HTML source:

<option value="callnum,phr">Call number</option>

With the preference set to 'don't use,' you should find this:

<option value="callnum">Call number</option>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19892: Replace numbersphr variable with Koha.Preference('OPACNumbersPreferPhrase...
Charlotte Cordwell [Thu, 18 Jan 2018 01:29:05 +0000]
Bug 19892: Replace numbersphr variable with Koha.Preference('OPACNumbersPreferPhrase') in OPAC

Test Case
1) Check that the following files have been changed properly.
opac/opac-search.pl
 opac/opac-main.pl
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt

2)Apply bug
3) Check that there are no differences in behaviour as a result of the patch.

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20291: DBRev 17.12.00.025
Jonathan Druart [Mon, 2 Apr 2018 21:05:39 +0000]
Bug 20291: DBRev 17.12.00.025

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20291: (follow-up) Rename NoLoginInstructions to OpacLoginInstructions
Nick Clemens [Thu, 29 Mar 2018 10:14:59 +0000]
Bug 20291: (follow-up) Rename NoLoginInstructions to OpacLoginInstructions

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20291: (follow-up) Add sysprefs.sql changes
Nick Clemens [Tue, 27 Feb 2018 10:45:46 +0000]
Bug 20291: (follow-up) Add sysprefs.sql changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20291: Add a StaffLoginInstructions preference for adding text to staff client...
Nick Clemens [Wed, 21 Feb 2018 04:56:23 +0000]
Bug 20291: Add a StaffLoginInstructions preference for adding text to staff client login

To test:
1 - Apply patches
2 - Upgrade database
3 - Check the staff client login page, should be no change
4 - Add something to the preferene
5 - It should appear on the login page

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20052: (follow-up) Fix QA tool complaints and bad copy
Nick Clemens [Thu, 29 Mar 2018 13:00:36 +0000]
Bug 20052: (follow-up) Fix QA tool complaints and bad copy

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20052: Add Koha Reports object class
Nick Clemens [Mon, 15 Jan 2018 14:38:13 +0000]
Bug 20052: Add Koha Reports object class

To test:
prove -v t/db_dependent/Koha/Reports.t

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18382: (QA follow-up) Make new unit test pass
Kyle M Hall [Wed, 28 Mar 2018 19:58:37 +0000]
Bug 18382: (QA follow-up) Make new unit test pass

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18382: Add a test
Jonathan Druart [Tue, 27 Mar 2018 17:09:54 +0000]
Bug 18382: Add a test

This is what I am expecting but I may be wrong.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18382: (QA follow-up) Don't set suspend_until if dt if undefined
Kyle M Hall [Tue, 27 Mar 2018 14:45:09 +0000]
Bug 18382: (QA follow-up) Don't set suspend_until if dt if undefined

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18382: (QA follow-up) Replace ->ymd by ->datetime
Marcel de Rooy [Thu, 22 Mar 2018 08:17:46 +0000]
Bug 18382: (QA follow-up) Replace ->ymd by ->datetime

The first patch makes Hold.t fail on:
not ok 8 - Hold is suspended with a date, truncation takes place automatically
   Failed test 'Hold is suspended with a date, truncation takes place automatically'
   at Hold.t line 94.
          got: '2018-03-22'
     expected: '2018-03-22T00:00:00'

We could remove the midnight time there, but we also could replace ymd by
datetime. The cpan doc tells us:
    Same as $dt->ymd('-') . 'T' . $dt->hms(':')

Test plan:
With this patch, run Hold.t again. It should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18382: action_logs entry for module HOLDS, action SUSPEND is spammy
Kyle M Hall [Mon, 5 Jun 2017 14:46:45 +0000]
Bug 18382: action_logs entry for module HOLDS, action SUSPEND is spammy

When a hold is suspended, 'suspend_until' is represented as a DateTime object, complete with locale. All told, this is about 800 lines of text.

Test Plan:
1) Enable the HoldsLog syspref
2) Add a hold on a record/item
3) Suspend the hold with a date to resume
4) Note the massive amount of date in the suspend_until field
5) Apply this patch
6) Suspend another hold with a date to resume
7) Note the log has an acutal date in the suspend_until field

Check the logs using module 'Holds' and Action 'Suspend'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20494: Remove unused code in neworderempty.pl and addbiblio.pl
Nick Clemens [Thu, 29 Mar 2018 12:33:56 +0000]
Bug 20494: Remove unused code in neworderempty.pl and addbiblio.pl

Should be sufficient to read code and see all lines were commented and
that this patch removes useless lines

To be thorough, ensure that your can add an order to a basket and add a
biblio.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18979: Speed up 'valid-templates.t' tests
Jonathan Druart [Wed, 19 Jul 2017 23:29:26 +0000]
Bug 18979: Speed up 'valid-templates.t' tests

Test plan:
Confirm than prove xt/author/valid-templates.t is quicker with this
patch.

Before I got:
Files=1, Tests=840, 21 wallclock secs ( 0.18 usr  0.02 sys + 20.28 cusr
0.32 csys = 20.80 CPU)

After:
Files=1, Tests=840, 17 wallclock secs ( 0.06 usr  0.01 sys + 21.56 cusr
0.48 csys = 22.11 CPU)

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20282: Match course reserve on holdingbranch
Nick Clemens [Fri, 23 Feb 2018 10:58:27 +0000]
Bug 20282: Match course reserve on holdingbranch

To test:
1 - Add a course (Course Reserves)
2 - Add an item to the course
3 - Ensure to change the holding branch for the course reserve
4 - Modify the course item
5 - Note the dropdwn for holding branch is unset
6 - Apply patch
7 - Modify the course item
8 - Dropdown should be correctly populated

Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20369: Analytics search is broken with QueryAutoTruncate set to 'only if * is...
Kyle M Hall [Mon, 12 Mar 2018 11:15:12 +0000]
Bug 20369: Analytics search is broken with QueryAutoTruncate set to 'only if * is added'

Test Plan:
1) Enable EasyAnalytics
2) Disable QueryAutoTruncate
3) Create an analytic record, add some host items to it
4) Browser to the analytics tab for the record
5) Click the link in the 'used in' column of the table
6) No search results
7) Apply this patch
8) Reload the page, now you get the analytic record!

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19907: Fix email validation in patron edit form
Josef Moravec [Wed, 3 Jan 2018 11:20:46 +0000]
Bug 19907: Fix email validation in patron edit form

Test plan:
0) Confirm that email validation is not working in add/edit patron form
1) Apply the patch
2) Edit/add patron, the e-mail validation should be working now
3) Ensure the password validation is still working (use test plan from
    bug 19908)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20462: Ensure batch item deletion will not delete the same item twice
Jonathan Druart [Mon, 26 Mar 2018 15:22:15 +0000]
Bug 20462: Ensure batch item deletion will not delete the same item twice

This has been done on bug 9509 when barcodes are scaned, but not when using a text file.

Test plan (stolen from Barton on the bug report):
1) Create a text file containing duplicate barcodes

Here's a quick way to do that, substitute INSTANCE for the instance name of your test server:

sudo koha-mysql INSTANCE <<< "select barcode from items where barcode is not null limit 3" | sed '1d;p' > /tmp/dup_barcodes.txt

2) Go to Home › Tools › Batch item deletion
3) Click 'Choose File', select the file you created in step 1.
4) Click 'Continue'
5) Note that duplicate items appear in the list of items to batch delete
6) Check 'Delete records if no items remain'
7) This will trigger a software error

Note that entering the barcodes via the 'scan items one by one' text box removes duplicates in the list, so this only causes problems when uploading a file.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20318: Add class 'required' to the label
Jonathan Druart [Mon, 2 Apr 2018 17:30:23 +0000]
Bug 20318: Add class 'required' to the label

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20318: Merge invoices can lead to an merged invoice without Invoice number
Christophe Croullebois [Wed, 14 Mar 2018 14:28:28 +0000]
Bug 20318: Merge invoices can lead to an merged invoice without Invoice number

When you want to merge invoices you have a page with a non editable
field 'Invoice number:' it shows the content of the first invoice to be
merged.
But if you validate by clicking the 'merge' button you arrive on the
next page which says that 'Invoice has been modified' and if you quit
this page without saving you have now a merged invoice without Invoice
number.
This tiny patch just prevents this issue to occur.

Test plan :

1° go to the acqui/invoices.pl page and search invoices to merge.
You must have at least 2 invoices on the same vendor
2° check boxes to select invoices to merge and click on 'merge selected
invoices' button
3° next page you see the non editable field 'Invoice number:'
4° click on the 'merge' button
5° next page you see 'Invoice has been modified'
6° leave this page i.e click on the left link 'Invoices'
7° search invoices you'll see the merged invoice without invoice number.

Apply the patch, replay the steps 1 to 3
4° on this page you can enter your invoice number and click on the
'merge' button.
If you leave this field empty and click merge, a message informs you
that it is required and you can not merge.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18474: (QA follow-up) Remove useless else in template
Kyle M Hall [Fri, 30 Mar 2018 11:08:30 +0000]
Bug 18474: (QA follow-up) Remove useless else in template

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18474: Restore multiple holds when patron is searched for
Jonathan Druart [Thu, 21 Dec 2017 18:59:24 +0000]
Bug 18474: Restore multiple holds when patron is searched for

We lost the ability to place multiple holds when we are searching for
patrons. The multi_holds parameter is lost and not handled correctly in
the template.

Test plan:
- Make sure you can place multiple holds for a patron you will search for
- Same for simple hold

TODO the multiple holds view should not be displayed if only 1 record
has been selected from the search result.

Signed-off-by: claude brayer <claude.brayer@cea.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20385: (follow-up) Assign blank instead of inappropraite value
Nick Clemens [Fri, 23 Mar 2018 17:12:13 +0000]
Bug 20385: (follow-up) Assign blank instead of inappropraite value

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20385: Don't try to get info for bad authtypecodes
Nick Clemens [Tue, 13 Mar 2018 14:57:47 +0000]
Bug 20385: Don't try to get info for bad authtypecodes

TO test:
0 - Have a koha with ES enabled and some auth records
1 - backup your db
2 - sudo koha-mysql <<instance>>
3 - UPDATE auth_types SET authtypecode="PERSO_NAMB" WHERE
authtypecode="PERSO_NAME" (or adjust as necessary)
4 - Search for some authorities where a PERSO_NAME record will be
returned
5 - KA_BOOM!
6 - Apply patch
7 - Results are returned, they do not display a code, viewing record you
won't see code

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20503: Prevent Borrower_PrevCheckout.t to fail randomly
Jonathan Druart [Fri, 30 Mar 2018 16:14:46 +0000]
Bug 20503: Prevent Borrower_PrevCheckout.t to fail randomly

category_type must be != "X"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20498: (bug 19641 follow-up) Patron advanced search form missing from patron...
Owen Leonard [Thu, 29 Mar 2018 17:57:01 +0000]
Bug 20498: (bug 19641 follow-up) Patron advanced search form missing from patron entry page

My patch moving patron-related templates' javascript to the footer left
out a script from the patron entry template which is required if the
patron header search menu is going to work.

To test, apply the patch and go to Patrons -> New patron.

Clicking the [+] link in the "Search patrons" header search form should
expand the advanced search options.

Test that the page's toolbar still "floats" correctly when you scroll
the page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: Remove unecessary Koha::Patron->store method
Jonathan Druart [Thu, 29 Mar 2018 15:45:39 +0000]
Bug 16330: Remove unecessary Koha::Patron->store method

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20490: Correct bug number typo in comment in Circulation.t
Lari Taskula [Wed, 28 Mar 2018 21:19:52 +0000]
Bug 20490: Correct bug number typo in comment in Circulation.t

NOTE: Confirmed that the typo of 17641 was part of bug 17941.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19784: Adapt /v1/patrons to new naming guidelines
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:35:45 +0000]
Bug 19784: Adapt /v1/patrons to new naming guidelines

This patch introduces two functions to the patrons endpoint:
- _to_api
- _to_model

This are in charge of field mappings in order to comply with the
guidelines.

Koha::REST::V1:Auth is adjusted to handle 'patron_id' as well. 'borrowernumber'
handling is kept until the existing endpoints get updated.

To test:
- Apply the patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/*.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19784: Remove reference to 'borrowernumber' param from other endpoints
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:25:35 +0000]
Bug 19784: Remove reference to 'borrowernumber' param from other endpoints

This patch removes the $ref occurences for borrowernumber in not
patron-specific endpoints. 'borrowernumber' is still used on them, but as a
hardcoded parameter. The param rename will happen on a separate bug for
each endpoint.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19784: Unit tests for /api/v1/patrons
Tomas Cohen Arazi [Fri, 8 Dec 2017 12:17:28 +0000]
Bug 19784: Unit tests for /api/v1/patrons

This patch adapts the existing endpoint's tests so they expect:
- 'patron_id' for 'borrowernumber'
- 'library_id' for 'branchcode'
- 'category_id' for 'categorycode'

In the process, I tried to make the tests more robust, by creating random
data that gets deleted to make sure our tests cases can't have false
positives.

Independent subtests are wrapped inside transactions to avoid
eventual interference.

To test:
- Apply the patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: The api doesn't implement the expected behaviour and attributes
for endpoint responses

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: (QA follow-up) Update usage of search plugin because of bug 19686
Josef Moravec [Mon, 19 Feb 2018 07:15:22 +0000]
Bug 16330: (QA follow-up) Update usage of search plugin because of bug 19686

Test plan:
prove t/db_dependent/api/v1/patrons.t
--> without  patch the list subtest fail
--> with patch test pass

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: Remove validation code from Koha::Patron
Tomas Cohen Arazi [Tue, 19 Dec 2017 17:46:45 +0000]
Bug 16330: Remove validation code from Koha::Patron

This patch removes previously added validation code from Koha::Patron
as we will rely on the DB structure and relationships to catch the same
problems. This is implemented on bug 19828.

This patch also adapts the API controller class to expect this behaviour
change from Koha::Patron. The expected exceptions are adjusted, and some
minor changes take place. The API tests are adjusted as well.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patrons.t
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests should still pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: (QA follow-up) ModMember requires borrowernumber
Tomas Cohen Arazi [Tue, 12 Dec 2017 21:53:45 +0000]
Bug 16330: (QA follow-up) ModMember requires borrowernumber

Works perfectly. Well done everyone!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: (QA follow-up) Repect guidelines on plurals Patron > Patrons
Tomas Cohen Arazi [Tue, 5 Dec 2017 19:43:00 +0000]
Bug 16330: (QA follow-up) Repect guidelines on plurals Patron > Patrons

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: Move patches to OpenAPI
Tomas Cohen Arazi [Mon, 4 Dec 2017 19:18:47 +0000]
Bug 16330: Move patches to OpenAPI

This patch refactors the original work so it implements the controllers
and the spec using Mojolicious::Plugin::OpenAPI, and OpenAPI for the specification.

It removes the ability for patrons without permissions to edit their own data or their
guarantee's. This will be moved to a patron modification requests endpoint for simplicity.

It makes use of bugs 19410 and 19686 and their dependencies to deal with parameters handling,
query building and pagination.

Tests are adapted.

To test:
- Apply this patches and the dependencies
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 16330: Add routes to add, update and delete patrons
Benjamin Rokseth [Wed, 27 Apr 2016 13:47:04 +0000]
Bug 16330: Add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19488: (QA follow-up) Fix spelling, remove ()
Katrin Fischer [Sun, 25 Mar 2018 20:10:22 +0000]
Bug 19488: (QA follow-up) Fix spelling, remove ()

Fixes spelling to match the details page and removes ().

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19488: Add borrowernumber to brief info on patron details pages in staff client
Jesse Maseto [Fri, 2 Mar 2018 14:48:06 +0000]
Bug 19488: Add borrowernumber to brief info on patron details pages in staff client

To test:
- View different tabs of a borrower's patron account in staff
- Verify the borrowernumber is shown in the brief info section
  on the left

Signed-off-by: JM Broust <jean-manuel.broust@univ-lyon2.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19564: (QA follow-up) Make commented out tests pass
Nick Clemens [Wed, 28 Mar 2018 12:42:19 +0000]
Bug 19564: (QA follow-up) Make commented out tests pass

We likely shoudln't pass through an uncoverted sort order for now, but
it does allow us to look ahead to implementing the orders directly so
seems a good option to have.

Either this patch should be used, or the commented out tests should be
removed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19564: Add tests for _convert_sort_fields
Jonathan Druart [Fri, 22 Dec 2017 18:21:51 +0000]
Bug 19564: Add tests for _convert_sort_fields

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19564: Fix extraction of sort order from sort condition name
David Gustafsson [Thu, 2 Nov 2017 14:02:23 +0000]
Bug 19564: Fix extraction of sort order from sort condition name

Currently sort order is extracted from sort condition by splitting the
field, instead use regular expression to extract the last part preceded
by underscore.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19673: Allow to set patron attributes to 0 with batch patron modification
Jonathan Druart [Thu, 21 Dec 2017 00:35:47 +0000]
Bug 19673: Allow to set patron attributes to 0 with batch patron modification

This patch will have to be tested deeply to make sure it will not
introduce regression!

The idea is to display an empty option in the patron attributes select
and ignore it. That way we can deal with false values 0 and "" which
were skipped before.

Test plan:
Add several patron attributes
Use the batch patron modification tool to add/update/remove them
Play with empty "" and 0 values, as well as other values
Modify several attributes in a row

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 19916: Add keyword and standard ID fields to acq external search
Nick Clemens [Thu, 4 Jan 2018 15:31:52 +0000]
Bug 19916: Add keyword and standard ID fields to acq external search

To test:
1 - Add an order from external source
2 - Note you don't have keyword or standard ID fields
3 - Add a catalog record from Z3950, note those fields are there
4 - Apply patch
5 - Check acq and note you do have those fields
6 - Do some searches to verify they work as expected

Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20330: Allow translating more of quote upload
Pasi Kallinen [Mon, 5 Mar 2018 07:09:28 +0000]
Bug 20330: Allow translating more of quote upload

Translate the error messages, and the table headers.

Test plan:

1) Go to Home -> Tools -> Quote editor -> Import quotes
2) Upload quotes from a file. Try to trigger the error messages
3) On successful import, check the table header texts
4) Apply patch, update & install a language
5) The error messages and the table header texts should
   show up in the xx-YY-staff-prog.po
6) Repeat 1,2,3

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18055: The 2 new deps are used for testing purpose
Jonathan Druart [Wed, 28 Mar 2018 18:54:56 +0000]
Bug 18055: The 2 new deps are used for testing purpose

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18055: (QA followup) Only print output if DEBUG
Tomas Cohen Arazi [Fri, 1 Sep 2017 15:25:27 +0000]
Bug 18055: (QA followup) Only print output if DEBUG

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager
Mason James [Thu, 15 Jun 2017 13:20:05 +0000]
Bug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager

add KOHA_PROVE_CPUS envar to manually set number of cpus

to test..

1/ set number of cpus to 1
 $ export KOHA_PROVE_CPUS=1

2/ observe 1 cpus are used
 $ time prove -v  t/db_dependent/00-strict.t
 t/db_dependent/00-strict.t ..
 Using 1 CPUs...

3/ unset number of cpus
 $ export KOHA_PROVE_CPUS=

4/ observe all available cpus are used
 $ time prove -v  t/db_dependent/00-strict.t
 t/db_dependent/00-strict.t ..
 Using 32 CPUs...

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager
Mason James [Sun, 5 Feb 2017 01:40:06 +0000]
Bug 18055: Speed up '00-strict.t' test, with Parallel::ForkManager

to test...

1/ run 00-strict.t test, (16.5 mins on a 4xcpu system)

$ time prove t/db_dependent/00-strict.t
...
Files=1, Tests=654, 994 wallclock secs ( 0.19 usr  0.04 sys + 873.40 cusr 116.20 csys = 989.83 CPU)
Result: PASS
real    16m34.104s

2/ apply patch

3/ install Parallel::ForkManager package
$ sudo apt-get install libparallel-forkmanager-perl libsys-cpu-perl

4/ run 00-strict.t test again, (now 6 mins.. much faster)

$ time prove t/db_dependent/00-strict.t
...
Files=1, Tests=654, 364 wallclock secs ( 0.07 usr  0.01 sys + 1159.20 cusr 153.41 csys = 1312.69 CPU)
Result: PASS
real    6m4.355s

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Edit: removed debian/control changes as the file is generated

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

6 years agoBug 20455: Fix sort patrons by date expired
Jonathan Druart [Mon, 26 Mar 2018 16:13:58 +0000]
Bug 20455: Fix sort patrons by date expired

We may need to apply this change for all other occurrences in our
codebase.

Test plan:
- Make sure sample patron data is loaded and you have a patron without a
date expired defined
- Make an empty search for all patrons or another search that gives you
a good amount of results
- Try to sort on the date expired column

=> Without this patch you get
Odd number of elements in anonymous hash
at /home/vagrant/kohaclone/C4/Utils/DataTables/Members.pm line 189.
output_pref is called with 'dateonly' (ref SCALAR), not a DateTime
object

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>