koha.git
2 years agoBug 30518: Unit test
Martin Renvoize [Wed, 13 Apr 2022 07:52:02 +0000 (08:52 +0100)]
Bug 30518: Unit test

This patch adds tests for checking the needs_advancing method against
a timezone and datetime that would cause an Invalid local time failure

To test:
1. Apply this patch
2. Run:
   $ kshell
   k$ prove t/db_dependent/StockRotationItems.t
=> FAIL: The feature is not implemented, tests fail to complete

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4450ad21100a02055e3f0f05918b2d4b17852107)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.14 release v21.05.14
Andrew Fuerste-Henry [Tue, 26 Apr 2022 13:05:42 +0000 (13:05 +0000)]
Update release notes for 21.05.14 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoIncrement version for 21.05.14 release
Andrew Fuerste-Henry [Tue, 26 Apr 2022 12:39:40 +0000 (12:39 +0000)]
Increment version for 21.05.14 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoTranslation fixes for 21.05.14
Andrew Fuerste-Henry [Tue, 26 Apr 2022 12:36:58 +0000 (12:36 +0000)]
Translation fixes for 21.05.14

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoTranslation updates for Koha 21.05.14
Koha translators [Tue, 26 Apr 2022 12:09:36 +0000 (09:09 -0300)]
Translation updates for Koha 21.05.14

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30142: Remove spaces from ElasticSearch mapping MARC fields
Thomas Klausner [Mon, 21 Feb 2022 11:35:15 +0000 (12:35 +0100)]
Bug 30142: Remove spaces from ElasticSearch mapping MARC fields

A first step to "validate" the MARC mappings: Remove all whitespace, so
if a user enters "245a " (with a trailing whitespace, which can easily
happen when copy/pasting) we only store "245a" in the DB. This is
neccessary, because the ES indexer will throw an exception in an invalid
MARC mapping.

Test Plan:
* Go to /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl
* Go to the Bibliographic Records Tab
* Enter "100 a b c " (notice the whitespaces!) in the first "mapping"
  field
* Scroll down and save
* Go back to the Bibliographic Records Tab
* The spaces are still there

Now apply the patch

* Repeat the above steps
* After saving you should see "100abc" without any spaces in the
  "mapping" field

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0dbb236d891b69f09ab06a62e2679755ea36621c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30406: Add column filters before hiding columns
Julian Maurice [Fri, 1 Apr 2022 08:16:09 +0000 (10:16 +0200)]
Bug 30406: Add column filters before hiding columns

The code that adds column filters works only on visible columns, so we
should hide columns after filters are created

Test plan:
1. Apply patch
2. Go to Tables settings. Hide city_state for the cities table.
3. Create some cities and go to the cities page
4. Verify that filtering works as expected.
5. Make the city_state column appear. Verify that filtering on this
   column works too

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 37594d77377dc4b0784d497d70aee05977277dee)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 19169: Add a test to detect unneeded 'atomicupdate' files
Mason James [Sat, 5 Mar 2022 02:30:21 +0000 (15:30 +1300)]
Bug 19169: Add a test to detect unneeded 'atomicupdate' files

to test...

1/ set git repo
    $ git reset --hard v21.11.03

2/ run test
    $ prove ./t
    OK

3/ apply patch

4/ run test again, observe FAIL

    $ prove ./t/00-check-atomic-updates.pl
    ./t/00-check-atomic-updates.pl .. 1/?
    #   Failed test 'check for unhandled atomic updates: bug_29596.pl'
    #   at ./t/00-check-atomic-updates.pl line 34.
    #                   'bug_29596.pl'
    #           matches '(?^u:.*pl$)'
    # Looks like you failed 1 test of 3.
    ./t/00-check-atomic-updates.pl .. Dubious, test returned 1 (wstat 256, 0x100)
    Failed 1/3 subtests

JD Amended patch: fix copyright year
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 1d24015e46c3127497aac31b2baddad547e4e8b3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29771: Scalar context for split
Tomas Cohen Arazi [Thu, 23 Dec 2021 19:58:57 +0000 (16:58 -0300)]
Bug 29771: Scalar context for split

This patch tackles a very specific scenario. Calling split(...,
CGI::param) makes it be called in list context. The split docs say:

split /PATTERN/,EXPR,LIMIT

this means the first CGI param will be used as EXPR and the second one
as LIMIT, which is wrong anyway. So the fix is to just force scalar
context.

To test:
1. Not sure, just make sure nothing breaks when using the scripts in the
   browser.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e5dc760b92bd939245c3d24a0cfa3db99f9ac764)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29771: Remove trivial cases
Tomas Cohen Arazi [Thu, 23 Dec 2021 19:16:58 +0000 (16:16 -0300)]
Bug 29771: Remove trivial cases

I squashed the patches because they are too trivial to have a test plan.
Or it is too much work to write the test plan for such trivial cases. I
leave the original commit messages just in case.

Generally, this are all cases in which CGI::param is being called in a
trivially identifiable _list context_. i.e. they are assigned to a
@variable.

I left one case out on purpose: admin/auth_subfields_structure.pl

Paul introduced this:

my @kohafield = ''.$input->param('kohafield');
and then:
my $kohafield = $kohafield[$i];

My intuition says it is forcing scalar context on the first assignment
so the list contains a single element and then inside the loop some
$kohafield assignments should lead to undef, and even warnings. I leave
it for a separate patch because it is not that easy testable and is a
sensible area.

Bug 29771: Remove warning from  acqui/finishreceive.pl

This patch removes a warning that shows when receiving.

To test:
1. Do the acq workflow up to the receive step.
2. Once you choose the items and click on Finish
=> FAIL: There's a warning in the logs
3. Revert receipt
4. Apply this patch
5. Receive
=> SUCCESS: No more warnings
6. Sign off :-D

Bug 29771: Remove warning from svc/members/add_to_list

To test:
1. Run:
   $ tail -f /var/log/koha/kohadev/*-error.log
2. Generate a patron list
3. Perform a patron search that gives you a few
4. Select some, and choose to add them to the list
=> FAIL: The logs show the infamous warn:
CGI::param called in list context from /kohadevbox/koha/svc/members/add_to_list
5. Apply this patch
6. Restart plack and repeat 4
=> SUCCESS: No warn!
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 1cfa7e38458b0e644ba7a34ae81520987071eca1)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30583: Fix hold system for translated templates
Jonathan Druart [Thu, 21 Apr 2022 14:30:24 +0000 (16:30 +0200)]
Bug 30583: Fix hold system for translated templates

There are missing quotes, and the translate script is messing up with
the generated template.

Error is:
Template process failed: file error - parse error - holds_table.inc line 216-217: unexpected token (hold)

The generated line, without this patch is:
216 <td><input %]="%]" class="printholdslip" data-reserve_id="[%" hold.reserve_id="hold.reserve_id" html="html" name="printholdslip" type="button" value="Recibo" |="|"></td>
With this patch applied:
216  <td><input class="printholdslip" data-reserve_id="[% hold.reserve_id | html %]" name="printholdslip" type="button" value="Recibo"></td>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30118: (QA follow-up) Fix Perl Critic issues
Kyle M Hall [Wed, 30 Mar 2022 16:34:55 +0000 (16:34 +0000)]
Bug 30118: (QA follow-up) Fix Perl Critic issues

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 61468ffe6d201cdb1257923d9fed575ffb5911cb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30118: Make holds_block_checkin in SIP behave like in Koha interface.
Matthias Meusburger [Wed, 17 Mar 2021 13:14:25 +0000 (14:14 +0100)]
Bug 30118: Make holds_block_checkin in SIP behave like in Koha interface.

In koha interface, a warning is displayed when an item on hold is returned
only if the return is for this specific item.

This patch does the same in SIP: the return is blocked when holds_block_checkin
is enabled and there is a hold on a specific item and this is the very item
being returned.

Test plan:

The following behavior is expected in SIP:

 - An item is returned, and there is a reservation on record-level: block
 - An item is returned, and there is a reservation on this very item: block
 - An item is returned, and there is a reservation on another item: allow

Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 41abb100c3d3e5cf97473abf06337e49f9b44710)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30541 - Resolve return claim works but "hangs" if MarkLostItemsAsReturned is...
Kyle M Hall [Thu, 14 Apr 2022 10:50:20 +0000 (06:50 -0400)]
Bug 30541 - Resolve return claim works but "hangs" if MarkLostItemsAsReturned is set for return claims

Basically, if MarkLostItemsAsReturned is set for return claims, the code will crash while trying to pull the checkout so it can update the lost status of the item. This is because the code assumes there must be a checkout and never checks the old_checkouts table.

This bug appears to only exist in 21.05 at this time. It was fixed by a combination of bugs 29495 and 28588.

Test Plan:
1) Set MarkLostItemsAsReturned for return claims
2) Mark a checkout as claims returned
3) Verify the checkout is no longer on the patron record
4) Resolve the claim
5) Note the attempt "hangs" but refreshing the page shows it worked
6) Apply this patch, restart all the things!
7) Repeat steps 2-4
8) It works!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Christine Lee <chlee@pascolibraries.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30172: Enqueue the job even if rabbitmq is not reachable
Jonathan Druart [Thu, 24 Mar 2022 15:24:06 +0000 (16:24 +0100)]
Bug 30172: Enqueue the job even if rabbitmq is not reachable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ce24a745c30f807587857e2f9449176ad4f78291)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30172: Prevent race condition when enqueuing a new task
Jonathan Druart [Thu, 24 Feb 2022 09:41:16 +0000 (10:41 +0100)]
Bug 30172: Prevent race condition when enqueuing a new task

As we are sending the job to the rabbitmq before in the transaction, the
worker can receive the job to process before the transaction committed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 40a329474486ffdef145466ddb66d65060d656ac)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29704: (RM follow-up) Fix typo sned send
Fridolin Somers [Tue, 18 Jan 2022 19:49:09 +0000 (09:49 -1000)]
Bug 29704: (RM follow-up) Fix typo sned send

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 1b1612170918241acca97ac34c16965378b4bd32)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29704: Add a triggered option to holds_reminder.pl
Nick Clemens [Fri, 17 Dec 2021 15:49:17 +0000 (15:49 +0000)]
Bug 29704: Add a triggered option to holds_reminder.pl

This patch adds an option to only trigger notices matching the number of
days waiting specified

You will need to define HOLD_REMINDER notices for the specific branch of the
patron and ensure the patron has hold reminder notices in their messaging preferences

TO test:
1 - Place a hold for a patron and check in to confirm
2 - Set the waiting date back a few days:
    update reserves set waitingdate = DATE_SUB(CURDATE(), INTERVAL 5 DAY);
3 - Run the cron and see that patron would be notified if running for 4 days weaiting
    perl misc/cronjobs/holds/holds_reminder.pl -v --days 4
4 - Apply patch
5 - perl misc/cronjobs/holds/holds_reminder.pl -v --days 4 --triggered
6 - Note patron would not be notified
7 - perl misc/cronjobs/holds/holds_reminder.pl -v --days 5 --triggered
8 - Note patron is notified when days waiting matches exactly

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b392547ab6937abafcd2e964f9d7490f1426a51c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30222: Remove warning
Jonathan Druart [Fri, 25 Mar 2022 08:05:18 +0000 (09:05 +0100)]
Bug 30222: Remove warning

Use of uninitialized value in string ne at misc/cronjobs/automatic_renewals.pl line 193.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6f574f6747b03bdf4d48a0a134da38b4a0442fe7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30222: Further simplify logic
Nick Clemens [Tue, 15 Mar 2022 13:34:39 +0000 (13:34 +0000)]
Bug 30222: Further simplify logic

For any borrower, we are either:
1 - following their preference, and that should set 'wants_email'
OR
2 - Never sending / following the cron, and can determine 'wants_email'
    from the 'send_notices' variable

This patch adds an 'else' if not using preferences to accomplish this

Follow test plan on previous patches

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 92c8bc7e4b7d39b5a4deb21ff3bc4bc6cce28c40)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30222: Simplify logic for reporting
Nick Clemens [Fri, 11 Mar 2022 13:24:33 +0000 (13:24 +0000)]
Bug 30222: Simplify logic for reporting

This patch adds two new variables:
$wants_email and $wants digest

These are used to simplify checks on whether notices should be sent

To test:
1 - Apply patch
2 - Confirm notices are not sent of pref is 'cron' and send_notcies flag not set
3 - Confirm notices are sent if pref is cron and send_notices flag is set and borrower
    does not have preference set for auto renewals
4 - Confirm notices not sent if pref is set to follow messaging preference and borrower
    does not have preferences set for auto_renewals
5 - Confirm regular notices sent if pref is set to follow messaging preferences and borrower
    does have the preference set but not digest
6 - Confirm digest notices sent if pref is set to follow messaging preferences and borrower
    does have the preference set and wants digest

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 17f1793ba952e3a95f98ec777d56486611b7036d)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30222: Only send auto renewal digest wehn there is an update
Nick Clemens [Fri, 11 Mar 2022 12:00:26 +0000 (12:00 +0000)]
Bug 30222: Only send auto renewal digest wehn there is an update

Currently, the code sends an email to the patron when there is any error that is not
'too_soon' - we also don't include issues that are 'too_soon', so emials may be missing information

This patch changes the code to:
1 - push all issues that were checked to the report when a borrower wants a digest
2 - adds a variable to track when any of the issues has been updated, and checkes this when
    sending digests
3 - if nothing has been updated, no report is sent to the patron

To test:
 1 - Checkout an item, marked for autorenewal, backdated to be overdue to a patron
 2 - Set preferences
    AutoRenewalNotices = 'according to patron messaging preferences'
    EnhancedMessagingPreferences = 'Allow'
 3 - Set the patrons preference for auto renewal to email+digest
 4 - Ensure the patron has an email
 5 - Place an item level hold for another patron on the issued item
 6 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
 7 - Check patron record/notices tab
 8 - Note item not renewed, patron notified
 9 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
10 - Note item not renewed, status not changed, patron notified again
11 - Apply patch
12 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
13 - Item not renewed, patron no notified
14 - Checkout another item marked for auto renewal to the patron, but due in the future
     ensure it is outside of 'no renewal before'
15 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
16 - Patron not notified, items not renewd
     Change to status of 'auto_too_soon' is not notified
17 - Checkout a third item, marked for auto renew, overdue
18 - place an item level hold for another patorn on third item
19 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
20 - patron is notified, nothing renewed, all statuses reported
21 - cancel the item level hold on third item
22 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
23 - item renewed, patron notified, all statuses reported
24 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
25 - nothing renewed, patron not notified, only change is one issue 'auto_too_soon'

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 3fac0c7aee782f96867d2384422962b038c5f7aa)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 26328: Add test
Jonathan Druart [Mon, 21 Mar 2022 14:56:21 +0000 (15:56 +0100)]
Bug 26328: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 68664b7b706945ad0d9176be69dd5fe71a0bd13b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 26328: Cast barcode from varchar to integer for incremental barcode
David Cook [Fri, 4 Dec 2020 05:36:04 +0000 (05:36 +0000)]
Bug 26328: Cast barcode from varchar to integer for incremental barcode

Without this patch, the incremental barcode generation will
treat 978e0143019375 as having an exponent and interpret it as a very
large number.

With this patch, the incremental barcode generation will first cast
barcode varchar strings to integers before finding a max() value.
In this case 978e0143019375 becomes 978 instead of
1.7976931348623157e308

Test plan:

0. Using koha-testing-docker

Before applying patch:

1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=autobarcode
2. Set to "generated in the form 1, 2, 3"
3. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
4. Add item with barcode 978e0143019375
5. Click "p - Barcode"
6. Note the barcode is "Inf"

After applying patch:
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
2. Click "p - Barcode"
3. Note the barcode is "39999000019194"

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 445cbb373bc7756494a4b28cede53ec23942999e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29020: Add link on the admin module
Jonathan Druart [Fri, 8 Oct 2021 13:57:31 +0000 (15:57 +0200)]
Bug 29020: Add link on the admin module

It works! P1 and P2 are inverted in the test plan, but
the principle that user with manage permission accesses
bg jobs from the admin page and user who do not only
have access through main page is there.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca55dc3e42c77f41f8c0cf66e6db9aeda4e66842)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29020: Add link on the mainpage for users without admin access
Jonathan Druart [Fri, 8 Oct 2021 13:53:02 +0000 (15:53 +0200)]
Bug 29020: Add link on the mainpage for users without admin access

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fde5d5f7019728f56a8e16433e52c17dd021dffa)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30220: Purchase suggestion defaults to first library
Owen Leonard [Thu, 3 Mar 2022 16:45:43 +0000 (16:45 +0000)]
Bug 30220: Purchase suggestion defaults to first library

This patch updates the OPAC suggestions form to update the variable
used to pre-select the logged-in user's library.

To test, apply the patch and make sure the "suggestion" preference is
set to "Allow."

- Log in to the OPAC and click "your purchase suggestions" in the
  sidebar menu on your summary page.
- Click "New purchase suggestion."
- The selected library should match the logged-in user's home library.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit caf905ca385b09b66c356fdd40315e1cdc8037e9)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30035: Fix failing test
Jonathan Druart [Fri, 4 Mar 2022 07:47:15 +0000 (08:47 +0100)]
Bug 30035: Fix failing test

Looks like there was a change in the output for Spanish.
Can be 'ene.' in older versions

Sponsored-by: Orex Digital
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 156c151006eed9b1e4a35b2b07449187ea31005e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30035: Fix month name in prediction pattern
Jonathan Druart [Mon, 7 Feb 2022 08:26:12 +0000 (09:26 +0100)]
Bug 30035: Fix month name in prediction pattern

We are using %B to display the month name but it seems that using the
CLDR pattern LLLL would be more appropriated.
https://metacpan.org/pod/DateTime#CLDR-Patterns
%B   - The full month name.
LLLL - The wide stand-alone form for the month.

For instance in Catalan:
https://metacpan.org/pod/DateTime::Locale::ca
%B will display "de gener" when LLLL will be "gener"

Test plan:
Create a new numbering pattern:
Home > Serials > Numbering patterns > New numbering pattern
Numbering formula: {X}
Label: monthname
Add: 1
Every: 1
Set back to: 1
When more than: 999
Formatting: Name of month
And test it at the bottom of the form
Locale: Catalan
The number column should contain "gener", not "de gener"
Test other locales and confirm that the output is correct (no change
expected for English, French and Spanish for instance).

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 93c33c527fdbfad0f46bc26a6b3496cba7d02fbb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29338: (follow-up) only show print button when hold is waiting or intransit
Lucas Gass [Tue, 21 Dec 2021 21:36:28 +0000 (21:36 +0000)]
Bug 29338: (follow-up) only show print button when hold is waiting or intransit

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8ff018c3867d35a426339343f66debdae80e1146)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29338: Add print hold/transfer button to request.tt
Lucas Gass [Wed, 27 Oct 2021 21:58:44 +0000 (21:58 +0000)]
Bug 29338: Add print hold/transfer button to request.tt

1. Apply patch
2. Make some holds, have some item level and some bib level
3. On request.tt notice a new column on the holds_table called 'Print hold/transfer slip'
4. Make sure the button works and takes you to the proper hold/transfer slip
5. Make sure it works well with both item/bib level holds

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a68021a2387ff1caf854c17fc5331e85926c1f7e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29482: Replace the term branch with library
Owen Leonard [Tue, 18 Jan 2022 12:46:51 +0000 (12:46 +0000)]
Bug 29482: Replace the term branch with library

This patch replaces the word "branch" with the word "library" in the
self-checkout template, as per terminology guidelines.

To test, apply the patch and go to Administration -> System preferences.

- Set the "IndependentBranches" preference to "Yes."
- Log into the self checkout system using a staff user with permission
  to do self-checkout but not superlibrarian status.
- Try to check out an item which belongs to a library that's different
  to the one you're logged in with.
- You should see a message, "Item cannot be checked out," including the
  text "This item belongs to another library."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 323428543012e9390c11463256d90a6105352625)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29875: Update wording on maxreserves system preference
Andrew Fuerste-Henry [Thu, 13 Jan 2022 19:17:06 +0000 (19:17 +0000)]
Bug 29875: Update wording on maxreserves system preference

To test:
1 - see the current wording
2 - apply patch
3 - words are changed

Test to confirm accuracy of wording:
1 - set maxreserves to 1
2 - set all/all circ rule to unlimited holds allowed total, holds allowed daily, and holds per record
3 - confirm you can place 1 hold for a patron, but the second is blocked
4 - set maxreserves to 0
5 - confirm you can place and number of holds for the patron
6 - set maxreserves to blank
7 - confirm you can place any number of holds for the patron

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a6e54eea79ae0097aa8936e0a75d63bf52b51951)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 28943: (QA follow-up) Fix opac.pref
Fridolin Somers [Sat, 22 Jan 2022 01:57:28 +0000 (15:57 -1000)]
Bug 28943: (QA follow-up) Fix opac.pref

Fix YAML syntax of opac.pref, we must use dash for new lines.

Also removes duplicate text before syspref.
No need to say "code" since it is now a list of categories.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 31fffa6006bf25bfa303fa44f4ae56f461cebb59)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 28943: Lower the risk of accidental patron deletion
Marcel de Rooy [Tue, 7 Sep 2021 12:22:05 +0000 (12:22 +0000)]
Bug 28943: Lower the risk of accidental patron deletion

If you do not use a temporary self registration patron category,
you should actually make the preference
PatronSelfRegistrationExpireTemporaryAccountsDelay empty.

As the comment in sysprefs.sql already said, we should not let
a zero value in the pref delete patrons too.

The module is changed now, the test adjusted and
the description of both related sysprefs modified.

Test plan:
Run t/db_dependent/Members.t
Check in Administration the two adjusted OPAC pref descriptions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8e500c57da0e33b517c13715d3a17271fe47c286)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.13 release v21.05.13
Andrew Fuerste-Henry [Thu, 24 Mar 2022 18:59:41 +0000 (18:59 +0000)]
Update release notes for 21.05.13 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoIncrement version for 21.05.13 release
Andrew Fuerste-Henry [Thu, 24 Mar 2022 18:44:58 +0000 (18:44 +0000)]
Increment version for 21.05.13 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoFix translations for Koha 21.05.13
Andrew Fuerste-Henry [Thu, 24 Mar 2022 18:41:33 +0000 (18:41 +0000)]
Fix translations for Koha 21.05.13

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoTranslation updates for Koha 21.05.13
Koha translators [Thu, 24 Mar 2022 18:18:08 +0000 (15:18 -0300)]
Translation updates for Koha 21.05.13

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 22993: Handle default messaging preferences during patron creation from API
Nick Clemens [Fri, 25 Feb 2022 20:04:41 +0000 (20:04 +0000)]
Bug 22993: Handle default messaging preferences during patron creation from API

TO test:
1 - Set default messaging preferences for a patron category
2 - Create a patron in that category using the API
3 - Verify messaging preferences are not set
4 - Apply patch, restart all
5 - Create another patron
6 - Verify messaging preferences are correctly set
7 - prove -v t/db_dependent/api/v1/patrons.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1e02087923230e5c6ecad66dcf1288a196ba2c81)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 22993: Unit tests
Nick Clemens [Fri, 25 Feb 2022 20:04:14 +0000 (20:04 +0000)]
Bug 22993: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c5577fa6ba3c7a29acbe83cde82b3195ef32ef86)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30203: Circulation.t: prevent locking by setting envvar
Marcel de Rooy [Thu, 3 Mar 2022 10:27:20 +0000 (10:27 +0000)]
Bug 30203: Circulation.t: prevent locking by setting envvar

Running this test without prove is disastrous. The LOCK in
the called SendCirculationAlert will ruin your data.
But no longer when you apply this patch.

Test plan:
Run prove Circulation.t
Inspect your data (e.g. borrowers table).
Run perl Circulation.t
Inspect your data (e.g. borrowers table) again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ac53c18af0896115db7cb8f7e9fd6c09ed3fd243)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoRevert "Bug 30098: Only redirect from patron search if single result is on first...
Andrew Fuerste-Henry [Thu, 24 Mar 2022 17:27:11 +0000 (17:27 +0000)]
Revert "Bug 30098: Only redirect from patron search if single result is on first page"

This reverts commit dd69c34eaf7643783d4604d25aafb893277eb054.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30098: Only redirect from patron search if single result is on first page
Nick Clemens [Mon, 14 Feb 2022 18:38:16 +0000 (18:38 +0000)]
Bug 30098: Only redirect from patron search if single result is on first page

This patch simply adds a check that we are oin the first page (starting at result 0)
before redirecting to a isngle patron

To test:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
4 - Apply patch
5 - Repeat search and paging
6 - On third page you remian in results and are not redirected to patron

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e77ca95756919ab1630a35b1c69e0fdc41289f27)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 26269: "Date due to" and "Show any items currently checked out" filters doesn...
Marion Durand [Mon, 18 Oct 2021 12:35:21 +0000 (14:35 +0200)]
Bug 26269: "Date due to" and "Show any items currently checked out" filters doesn't work properly in overdues.pl

Filter "Date due to" is now taken into account even when filled with a
future date for the displayed result and downloaded results.
Filter "Show any items currently checked out" is now taken into account
for the downloaded results.

To test:
1- Go to Circulation then to overdues
2a- Add a filter with "Date due To" > today
2b- Check that only the results with "Due date" < today are displayed
(not those with "Due date" between today and the date requested)
2c- Click on "Download file of displayed overdues"
2d- Check that the file contains only the results with "Due date" <
today (not those with "Due date" between today and the date requested)
3a- Reset filter and then add the filter "Show any items currently
checked out"
3b- Check that all the results are displayed (even those with "Due date"
> today)
3c- Click on "Download file of displayed overdues"
3d- Check that the file contains only the results with "Due date" <
today (not those with "Due date" between today and the date requested)
9- Apply the patch
10- Repeat step 1 to 8, checking that all the results corresponding to
the selected filter are now displayed/downloaded

https://bugs.koha-community.org/show_bug.cgi?id=26269

Signed-off-by: Theodoros Theodoropoulos <theod@lib.auth.gr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0b349d35604817e125eb5719edd168ca03f33995)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29220: Minor fixes and improved code readability
David Gustafsson [Wed, 13 Oct 2021 13:36:43 +0000 (15:36 +0200)]
Bug 29220: Minor fixes and improved code readability

The current handling of onsite checkouts with OnSiteCheckoutsForce
syspref enabled is confusing and hard to understand. It's also fragile
with a high risk future changes could result in subtle bugs.

Also fix an inconsistency in which errors (DEBT_GUARANTORS) are considered blocking for
forced onsite checkouts.

To test:
1) Enable OnSiteCheckouts, disable OnSiteCheckoutsForce
2) Edit a biblio item and for example set Not for loan to a value
restricting loans
3) Try to check out the item for some patron
4) A message that item is not for loan should be displayed
5) Select "On-site checkout" and try again
6) The same message should be displayed
7) Try to checkout with some invalid barcode
8) A message that barcode was not found should be displayed
9) Now enable OnSiteCheckoutsForce
10) Try to checkout the item for some patron
11) A message that item is not for loan should be displayed
12) Select "On-site checkout" and try again
13) Checkout should now succeed, no messages should be displayed
14) Try to checkout with some invalid barcode
15) A message that barcode was not found should be displayed
16) All of the above steps should produce the same result with and without this patch

Additional:
Before patch:
 a) Set  NoIssuesChargeGuarantorsWithGuarantees to 1
 b) add a guarantee with another guarantor
 c) charge a 1.01 fine to other guarantor
 d) checkout is blocked due to fines
Apply patch
 e) checkout is allowed when onsite checkouts forced

Sponsored-by: Gothenburg University Library
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ad5699ea1dc95b4ed22bc56a9615dfcff02a2990)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29886: Add Koha::Suggestions->search_limited
Tomas Cohen Arazi [Fri, 14 Jan 2022 16:03:54 +0000 (13:03 -0300)]
Bug 29886: Add Koha::Suggestions->search_limited

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 2bcac55ba4372d2f6d7899cd973242db1211ce67)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29886: Unit tests
Tomas Cohen Arazi [Fri, 14 Jan 2022 17:49:29 +0000 (14:49 -0300)]
Bug 29886: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit bd082b5506cfaf08362b9634b0532d98f79fa9fa)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29687: Uninitialized warning C4/XSLT line 286
Marcel de Rooy [Mon, 13 Dec 2021 13:23:57 +0000 (13:23 +0000)]
Bug 29687: Uninitialized warning C4/XSLT line 286

From plack-opac-error.log:
[WARN] Use of uninitialized value $value in concatenation (.) or string at /usr/share/koha/C4/XSLT.pm line 286.

Test plan:
An opac search triggered the warning. So repeat it without warns.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 74382c321c16348919f83f63e505dea93239c2ca)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30164: Fix datatable wrapper when no filter passed
Jonathan Druart [Wed, 23 Feb 2022 14:21:04 +0000 (15:21 +0100)]
Bug 30164: Fix datatable wrapper when no filter passed

This problem appears (at least) on the cities list view:
If you pass a filter in the "Search cities" filter in the header, it
won't be taken into account and all the cities will be displayed.

There are two problems. First we are passing an "empty" q=[] in the
body, the filter from the header is passed as URL parameters. We should
not need to pass the q if it's empty.
Then the main problem is coming from a bug in
Koha::REST::Plugin::Query but I didn't manage to track it down. If we
have two 2 passed, only the second one will be used. We are certainly
using a hash somewhere we should not.

This patch is fixing the bug but not on the correct side. A follow-up
bug should take care of the main problem at lower level.

Test plan:
Hit /admin/cities.pl
Create some cities
Use the filter in the header of the page and submit
=> Without this patch all cities are retrieved
=> With this patch applied only the relevant cities are displayed.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43dd25e2aa2298bea2a60cacaa8c465cf5f7678c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30153: (QA follow-up) Fix unit tests
Martin Renvoize [Tue, 22 Feb 2022 16:28:19 +0000 (16:28 +0000)]
Bug 30153: (QA follow-up) Fix unit tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fa24b608c1749bdd501bb97a47193aa218f63646)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30153: Use uppercase AND to join query parts
Thomas Klausner [Tue, 22 Feb 2022 14:09:58 +0000 (15:09 +0100)]
Bug 30153: Use uppercase AND to join query parts

C4::Search->FindDuplicate joins title and author using 'and'
(lowercase). When this query is passed on to ElasticSearch, it
interprets the lowercase 'and' as a term to search for, because the
operator has to be in uppercases ('AND').

Test plan:
* Reproduce the bug:
- Set SearchEngine to ElasticSearch (and make sure you have the data
  indexed etc)
- Find an existing book, note the title (245a) and the author (100a)
- Create a new book (Cataloging -> New Record)
- Fill in the same title and author using the same data as in an
  existing book (and any other fields that might be required)
- Click "save"
=> A new book will be created, the Duplicate Finder has failed

* Apply the patch

* Check if it's working now:
- Create a new book (Cataloging -> New Record)
- Fill in the same title and author using the same data as in an
  existing book (and any other fields that might be required)
- Click "save"
- The DuplicateFinder should now report the already exising book

Maybe we should also check if Zebra does not have any problems with the
uppercase 'AND'? In that case, repeat the above steps, but set
SearchEngine to Zebra :-)

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit eebfe5005a74768ca8e1f628a0d9b8b84d135b63)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29287: Add child funds to display of parent funds on acqui home
Nick Clemens [Wed, 20 Oct 2021 18:47:01 +0000 (18:47 +0000)]
Bug 29287: Add child funds to display of parent funds on acqui home

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Michael Sutherland <sudrland@vt.edu>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit bfecc7bff27000416fd1c91e64e0edd8c67b1ab7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30132: Fix POD, show correct usage of Getopt::Long
David Schmidt [Fri, 18 Feb 2022 14:00:20 +0000 (15:00 +0100)]
Bug 30132: Fix POD, show correct usage of Getopt::Long

the USAGE of overdue_notices.pl shows options such as -date OR
-csv that should be written with double dashes like --date or --csv

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0322275a5bce6b849513994d626852fe47ef8ee4)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 28663: Prevent discounts against void lines
Martin Renvoize [Mon, 5 Jul 2021 18:37:57 +0000 (19:37 +0100)]
Bug 28663: Prevent discounts against void lines

With the introduction of double entry accounting for VOID actions, we
need to add an additional filter to the 'Apply discount' button appearance

Test plan
1/ Add a debt
2/ Pay the debt
3/ Void the payment
4/ Confirm that with the patch applied the 'Apply discount' button does
not appear on the 'Void' accountline.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a09e800b955e3929f0e7ca85a9d9ecf5e87e7674)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30084: Remove dependency of liblocale-codes-perl (follow-up)
Mason James [Wed, 2 Mar 2022 05:52:24 +0000 (18:52 +1300)]
Bug 30084: Remove dependency of liblocale-codes-perl (follow-up)

trival patch, no test plan

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7bf6f0d1fd9983d8deae8014775e51a2393e5b38)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30084: Remove explicit dependency of liblocale-codes-perl
Mason James [Mon, 24 May 2021 21:21:53 +0000 (09:21 +1200)]
Bug 30084: Remove explicit dependency of liblocale-codes-perl

1/ apply patch

2/ build and install new koha-common package

=> Package liblocale-codes-perl is not installed, Koha does not need it

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Mason James <mtj@kohaaloha.com>
JD amended patch: fix commit message
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
(cherry picked from commit b793c25f80a69b292d7300f53892b291534341af)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30133: (follow-up) Update objects.search POD
Tomas Cohen Arazi [Mon, 21 Feb 2022 11:59:05 +0000 (08:59 -0300)]
Bug 30133: (follow-up) Update objects.search POD

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit dca673eee6d3a5963c3957060cd94143d25fd24b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30133: Fix pagination in /biblios/:bibio_id/pickup_locations
Tomas Cohen Arazi [Fri, 18 Feb 2022 19:07:02 +0000 (16:07 -0300)]
Bug 30133: Fix pagination in /biblios/:bibio_id/pickup_locations

This patch does the same thing we did for items on the previous patch,
but for biblios. The tests are almost the same as well.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4b24f538bd2ea9b4660cda528e90d7576b7d3870)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30133: Simplify code
Tomas Cohen Arazi [Fri, 18 Feb 2022 18:22:36 +0000 (15:22 -0300)]
Bug 30133: Simplify code

This patch simplifies the code, and also fixes a problem with branchcode
comparisson failing, highlighted when running the tests

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> FAIL: Tests fail. Notably:
- Link header pagination is wrong
- X-*Total-Count headers have two values (dupicated)
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit eb5dbb4010c6f95f6ddaf594d8aee22509acec42)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30133: Avoid calling c->objects->search twice
Nick Clemens [Fri, 18 Feb 2022 14:25:41 +0000 (14:25 +0000)]
Bug 30133: Avoid calling c->objects->search twice

Calling this twice sets double pagination headers, which messes up the page for the requests and
retrieves on ly the end of the list

This patch simply avoids a doulbe call

TO DO: must implement same for Biblio->pickup_locations and cover with tests
this also returns all as needing override

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit eb281a56cd83a3215d39204f51e3cc5987458480)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30133: Regression tests
Tomas Cohen Arazi [Fri, 18 Feb 2022 18:33:42 +0000 (15:33 -0300)]
Bug 30133: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit cfe9578eeee1871b606028099fa08a1e9f1f91cd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 27770: ES: Deprecated aggregation order key [_term] used, replaced by [_key]
Kevin Carnes [Tue, 8 Feb 2022 13:35:18 +0000 (14:35 +0100)]
Bug 27770: ES: Deprecated aggregation order key [_term] used, replaced by [_key]

Starting in Elasticsearch 6.0 _key should be used instead of _term to order
buckets by their term

To test:
1) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
2) If you observe an error about types, apply patch for bug 25669
3) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4) Observe if you get a deprecation warning about order key
5) Apply patch
6) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
7) Observe no deprecation warning about order key
8) Sign off

Sponsored-by: Lund University Library
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 2cd93d8ea6cab9ba189fc6946ddf1e1fd3619067)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoCorrect syntax error in updatedatabase
Andrew Fuerste-Henry [Sun, 20 Mar 2022 14:05:16 +0000 (14:05 +0000)]
Correct syntax error in updatedatabase

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoMerge 21.05.12 security branch into 21.05.x
Andrew Fuerste-Henry [Tue, 15 Mar 2022 13:13:25 +0000 (13:13 +0000)]
Merge 21.05.12 security branch into 21.05.x

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.12 release v21.05.12
Andrew Fuerste-Henry [Thu, 10 Mar 2022 20:24:06 +0000 (20:24 +0000)]
Update release notes for 21.05.12 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoIncrement version for 21.05.12 release
Andrew Fuerste-Henry [Thu, 10 Mar 2022 20:01:21 +0000 (20:01 +0000)]
Increment version for 21.05.12 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29931: [21.05.x] Check cookie status before continuing
Marcel de Rooy [Mon, 24 Jan 2022 10:24:08 +0000 (10:24 +0000)]
Bug 29931: [21.05.x] Check cookie status before continuing

Test plan:
Logout from staff.
Try to run plugins-enable (you should have some active plugin).
Like: https://yourserver:staffport/cgi-bin/koha/plugins/plugins-enable.pl?class=Koha::Plugin::Test&method=enable
Replace class and method as appropriate.
Verify that with this patch, you will be redirected to 401 page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 29931: (follow-up) Similar thing in opac-patron-image.pl

Although less harmful indeed. No borrowernumber, no image.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested: logged in, logged out, prefs toggled. All fine.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 29931: (follow-up) Fix svc/checkouts and return_claims too

Adding the same auth_status check here too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29956: Prevent login form to be serialized into cookie
Jonathan Druart [Thu, 27 Jan 2022 13:14:27 +0000 (14:14 +0100)]
Bug 29956: Prevent login form to be serialized into cookie

To recrate:
Logout
Go to /cgi-bin/koha/opac-search.pl
Click "Log in to your account"
Fill in the login form
Submit
Check the 'form_serialized' cookie's value

=> Without this patch it contain login/password
=> With this patch applied the cookie is not created

Confirm that the "Return to the last advanced search" feature still
works as expected.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30129: Add test
Jonathan Druart [Mon, 21 Feb 2022 11:59:40 +0000 (12:59 +0100)]
Bug 30129: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 277656b7c88348f50292ff2251f924a2a1aeaea6)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30129: remove the third required date that was causing 500 error
Petro Vashchuk [Fri, 18 Feb 2022 11:42:34 +0000 (13:42 +0200)]
Bug 30129: remove the third required date that was causing 500 error

This problem appeared because of this commit:
Bug 14435 Add the ability to store result's report
cf9031711282f4be23e4a639797d0fd178940e1f

This patch fixes it by removing the third $date that wasn't removed
back then.

To reproduce:
1) Head over to Reports page.
2) Search for report by date. It should cause 500 error.
3) Apply the patch.
4) Repeat the search again, it should be working now.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b942054038ec149864282c764a42e0eeb71b5f89)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30115: Uninitialized value warning in C4/Output.pm
Blou [Tue, 15 Feb 2022 21:18:15 +0000 (16:18 -0500)]
Bug 30115: Uninitialized value warning in C4/Output.pm

Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 180.
Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 197.
Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 211.

This is in pagination_bar sub.  A lot of pages call it.  For me it
happened with any Authority search (authorities/authorities-home.pl)
producing multiple results.

Simple fix is initializing the variable.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cdab942ee00ab916ed58033a20419414c9dc21b0)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29625: Add test for get_all_biblios_iterator
Jonathan Druart [Fri, 18 Feb 2022 10:01:55 +0000 (11:01 +0100)]
Bug 29625: Add test for get_all_biblios_iterator

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit bfb2e727f9b8ccfb48b7c0ddd8fbb195d562f08f)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29625: Fix var name in Koha::BiblioUtils get_all_biblios_iterator
Fridolin Somers [Thu, 2 Dec 2021 22:21:45 +0000 (12:21 -1000)]
Bug 29625: Fix var name in Koha::BiblioUtils get_all_biblios_iterator

In Koha::BiblioUtils, get_all_biblios_iterator method is a class level method like get_from_biblionumber.
So its first arg should be named $class instead of $self.
Even if this var in not used.

Test plan :
1) Run Elasticsearch full rebuild with and without patch
2) Check all biblio records are in index

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b3aa9102bb6b92e35d1b24247a1ba8447f808f51)

2 years agoBug 22671: Show warning if browser doesn't support applicationCache
Owen Leonard [Mon, 18 Oct 2021 12:29:19 +0000 (12:29 +0000)]
Bug 22671: Show warning if browser doesn't support applicationCache

This patch adds a check for browser support for the "applicationCache"
feature required by the offline circulation tool. If the feature is not
available, a message is shown to the user that offline circulation is
disabled.

To test, apply the patch and enable the AllowOfflineCirculation system
preference.

In a browser which supports applicationCache (Firefox < 81, Chrome < 94,
Safari <= 15), go to Circulation -> Built-in offline circulation
interface.

- You should see the standard Offline Circulation menu options: Check
  out, check in, syncrhonize, etc.
- Click "Synchronize," then "Download records."
- The process should complete correctly, updating the "last synced"
  information on the page.

Follow the same steps in a browser which has dropped support for
applicationCache. As soon as you reach the built-in offline circulation
page you should see a message, "Your browser is not compatible..."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e79a1723c6b10d71a8b82e295836247e52c2fad3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29853: Add HTML filter before KohaSpan filter
Fridolin Somers [Wed, 12 Jan 2022 05:40:35 +0000 (19:40 -1000)]
Bug 29853: Add HTML filter before KohaSpan filter

Usage of Template Toolkit plugin KohaSpan as filter is actually :
  Group [% added.title | $KohaSpan class = 'name' | $raw %] created.

But KohaSpan filter does not escape HTML characters.
Whe should filter HTML then KohaSpan.

This patch adds TT html filter before KohaSpan.
Also replaces in Javascript html() with text()
to ensure special caracters are still encoded.
See https://api.jquery.com/text/

Test plan :
1) Create a library with name Libra&apos;rie
2) Create a library group with name Grou&apos;pe
3) Play with this group
4) Add library
5) Remove library
6) Edit group
7) Delete group
8) Each time check that &apos, is not interpreted as single quote

Signed-off-by: Solène Desvaux <solene.desvaux@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f80d9d6d78daaaa3523c962184c1314ca5613796)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29795: add empty value for branchcode on self-reg form
Lucas Gass [Tue, 4 Jan 2022 22:44:32 +0000 (22:44 +0000)]
Bug 29795: add empty value for branchcode on self-reg form

1. Set branch code as a PatronSelfRegistrationBorrowerMandatoryField
2. Go to the self reg form and look at the Home library field, it defaults to the first choice alphabetically
3. Fill out the other required fields and the captcha. Don't change the branchcode value.
4. Submit the form, it submits.
5. If branchcode is required it should default to an empty value and force the user to make a choice.
6. Apply patch
7. Repeat 1-3
8. Now you cannot submit the form unless you choose a branchcode
9. Make sure it still works normally when branchcode is not in PatronSelfRegistrationBorrowerMandatoryField

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 51f3360434cc29773539eef9ccd59ff44d2e9f1e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30072: (follow-up) Silence useless warning
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:35:31 +0000 (15:35 -0300)]
Bug 30072: (follow-up) Silence useless warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit eb29bce9cb538c89b12e26aa1b2eeeb96a0174b7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30072: Add missing hold actions plugin hooks
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:28:31 +0000 (15:28 -0300)]
Bug 30072: Add missing hold actions plugin hooks

This patch introduces the after_hold_action plugin hook, with 4
different 'action' parameters:

- fill
- cancel
- suspend
- resume

To test:
1. Apply the unit tests
2. Run:
   $ kshell
  k$ t/db_dependent/Koha/Plugins/Holds_hooks.t -v
=> FAIL: The hooks are not in the code, so the expected output from the
Koha::Plugin::Test plugin is not there, and the tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Note: I think we could deprecate 'after_hold_create' and migrate it to
the one introduced here, using the 'place' action.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f2d1b126b97ede8d67a3deee97c3a2dc44b334c8)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30072: Unit tests
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:28:10 +0000 (15:28 -0300)]
Bug 30072: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ecbe50aa317a27d6ce55317ceec51e8b1c72c6a3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29877: Make POST /holds handle maxreserves correctly
Tomas Cohen Arazi [Thu, 13 Jan 2022 15:10:30 +0000 (12:10 -0300)]
Bug 29877: Make POST /holds handle maxreserves correctly

The current implementation doesn't consider the following values for the
syspref: undef and 0.

The tests mistakenly didn't cover them.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, obvious warnings about comparing undefined values
         too.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. You can try on Postman as well
=> SUCCESS: Behavior is correct!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b002a84a2c6e5ee59562620b62bb21cfc7f61a02)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29877: Regression tests
Tomas Cohen Arazi [Thu, 13 Jan 2022 15:10:24 +0000 (12:10 -0300)]
Bug 29877: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8ea1b883b76187a1d863f08426b65f5321fd703e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29596: correct DBRev
Andrew Fuerste-Henry [Mon, 7 Mar 2022 14:39:33 +0000 (14:39 +0000)]
Bug 29596: correct DBRev

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29706: (follow-up) Adjust code to work for multi-holds
Nick Clemens [Tue, 8 Feb 2022 12:30:23 +0000 (12:30 +0000)]
Bug 29706: (follow-up) Adjust code to work for multi-holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 49204945f033a692656a966228a0a308b2f6811a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29706: Hide items that cannot be held by default when placing hold on OPAC
Nick Clemens [Thu, 16 Dec 2021 01:59:50 +0000 (01:59 +0000)]
Bug 29706: Hide items that cannot be held by default when placing hold on OPAC

This patch adds a 'holdable' and 'unholdable' class to the rows of the table

Additionally I rename the 'backgroundcolor' field to 'onloan' as that is what it contains.
Note: Out of the box, there is no css associated with this class

I add a div around the table to allow hiding the new buttons as well when optiuons are hidden

It would be nice in the future to utilise a Koha table here, however, it is complicated by multi-holds

To test:
 1 - Add a number of items to a record, ensuring they belong to different libraries
 2 - Set 'Default checkout, hold and return policy'->'Hold policy' to 'From home library'
 3 - Sign in to opac and attempt to placehold on the record
 4 - Click 'show more options' and 'a specificitem'
 5 - Note holds table includes items that cannot be held
 6 - Apply patch
 7 - Reload holds page
 8 - Note items that cannot be heldare hidden
 9 - Click 'Show unholdable items' and note they appear
10 - Click 'Hide unholdable items' and veriofy they hide
11 - Test with multi holds

Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8b13fc7ebbc236ea2358b1da58e871e6090cb396)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29706: Improve table elements
Nick Clemens [Thu, 16 Dec 2021 01:12:52 +0000 (01:12 +0000)]
Bug 29706: Improve table elements

This patch add a thead and tbody element to the 'copiesrow' table

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e14bdb2f1723839953d143ad0039bdd91e678ac3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29596: DBRev 21.05.11.001
Andrew Fuerste-Henry [Fri, 4 Mar 2022 15:28:35 +0000 (15:28 +0000)]
Bug 29596: DBRev 21.05.11.001

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29596: Add Yiddish language
Tomas Cohen Arazi [Mon, 29 Nov 2021 21:35:46 +0000 (18:35 -0300)]
Bug 29596: Add Yiddish language

This patch adds the Yiddish language to Koha. The language codes were
taken from https://www.loc.gov/standards/iso639-2/php/code_list.php

Sponsored-by: Universidad Nacional de San Martín
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 808fb2679bb4c3574589486546d61e0d392c8368)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 28576: Update the maximum size of an image.
The Minh Luong [Tue, 1 Feb 2022 19:44:06 +0000 (14:44 -0500)]
Bug 28576: Update the maximum size of an image.

This patch modifies the maximum size of a patron's image, from 500KB to
2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a
patron, you can now see the supported file types AND the maximum size.

The following places are affected by this patch:
- Home/Patrons/anyPatron
- Home/Tools/Upload patron images
- Home/Tools/Patron card creator/Images

To test:
1)Search for any patron and go to his page.
2)Hover over the image area on the left and click on the "Add" button.
3)Notice that the message above the choose file button only specifies
file types without the maximum size.
4)Add an image bigger than 500KB.
5)Nothing happens. (This is because the maximum size is 5KB)
6)Apply the patch.
7)Repeat steps from 1 to 3.
8)Notice that the message now includes the maximum size.
9)Add an image bigger than 500KB, but smaller than 2MB.
10)The image is succesfully uploaded.
11)Add an image bigger than 2MB.
12)Nothing happens. (The maximum size is now 2MB)
13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and
"Home/Tools/Patron card creator/Images".
14)Notice that the maximum size is updated.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cc49fd7e00a789d15aac7294dfc8066a2c5c3752)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 28576: Add patron image in patron detail section does not specify image size...
Salman Ali [Wed, 16 Jun 2021 17:20:24 +0000 (13:20 -0400)]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 196e964237f4be0ca53bf27cbc53b0677c9b58ad)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.11 release v21.05.11
Andrew Fuerste-Henry [Mon, 21 Feb 2022 17:44:25 +0000 (17:44 +0000)]
Update release notes for 21.05.11 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoIncrement version for 21.05.11 release
Andrew Fuerste-Henry [Mon, 21 Feb 2022 17:37:51 +0000 (17:37 +0000)]
Increment version for 21.05.11 release

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoFix translations for Koha 21.05.11
Andrew Fuerste-Henry [Mon, 21 Feb 2022 17:34:40 +0000 (17:34 +0000)]
Fix translations for Koha 21.05.11

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoTranslation updates for Koha 21.05.11
Koha translators [Mon, 21 Feb 2022 17:13:36 +0000 (14:13 -0300)]
Translation updates for Koha 21.05.11

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30090: Don't export some columns in patron search results
Fridolin Somers [Mon, 14 Feb 2022 21:04:25 +0000 (11:04 -1000)]
Bug 30090: Don't export some columns in patron search results

The checkout and Edit buttons should not export (Exel, Print) on the patron search result list.
Same for fist column with checkboxes.

Test plan :
1) Go to patrons module /cgi-bin/koha/members/members-home.pl
2) Perform a search with results
3) Click on 'Export' then 'Print'
=> Check you dont see column with checkboxes (text 'Select patron') and colum with actions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d2452e0c09a894961c900f73676519f044151884)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 30082: Bibliographic details tab missing when user can't add local cover image
Owen Leonard [Fri, 11 Feb 2022 15:24:43 +0000 (15:24 +0000)]
Bug 30082: Bibliographic details tab missing when user can't add local cover image

This patch corrects the template logic which determines whether the
"Images" tab should be displayed on the bibliographic detail page. The
"Images" tab should display whenever local cover images are enabled, not
just if the user has permission to manage cover images.

To test, apply the patch and go to Administration -> System preferences.

- Enable the LocalCoverImages system preference.
- Locate and view the detail page for a bibliographic record in the
  catalog which doesn't have a local cover image attached.

  - If you are logged in as a user with upload_local_cover_images
    permission you should see an "Images" tab with the message "No
    images have been uploaded for this bibliographic record yet" and an
    upload button.
  - If you are logged in as a user without upload_local_cover_images
    permission you should see an "Images" tab with just the "No
    images..." message.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 557bcbfa5240dd4b8fd4a32b7cde04183f86bc77)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29952: Replace obsolete DataTable column filter function
Owen Leonard [Thu, 27 Jan 2022 11:50:28 +0000 (11:50 +0000)]
Bug 29952: Replace obsolete DataTable column filter function

The "Filter paid transactions" link on the Accounting -> Transactions
page is broken because it uses an obsolete DataTables function for
filtering. This patch updates it to use the current syntax, available in
DataTables since version 1.10.

To test, apply the patch and locate a patron in the staff interface who
has multiple fines, some paid.

- View the patron's "Accounting" page and click the "Transactions" tab.
- Click the "Filter paid transactions" link. The table should be
  filtered so that only transactions with an outstanding amount > zero
  are shown.
- The filter link should change to read "Show all transactions."
- Clicking "Show all transactions" should clear the filter.
- Test with one or more columns hidden using the "Columns" control.
  Filtering should still work correctly with columns hidden.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a8dea1e7027ebcfb051a898dbf5401d284eddcdb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29385: Catch register_id for payments against fees
Jonathan Druart [Thu, 2 Dec 2021 12:52:45 +0000 (13:52 +0100)]
Bug 29385: Catch register_id for payments against fees

This patch refactors the pay method in SIP FeePayment such that we
consistently pass parameters to both invocations of Koha::Account->pay.

It ensure the missing cash_register definition is passed when a set of
account lines to pay is defined.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e8b1bc88508c1cf919b21cf93a0f7163e1c07289)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29754: (QA follow-up) Minor tests tweaks
Tomas Cohen Arazi [Mon, 7 Feb 2022 11:58:43 +0000 (08:58 -0300)]
Bug 29754: (QA follow-up) Minor tests tweaks

This patch does two things:

- Wraps the new SIP tests in a single transaction. We do that to avoid
  sub-test interference, specially when test files get big. The provided
  tests are correct and don't require previous tests data.
- Migrated from the introduced 'diag' calls to 'note', as I just learned
  they are the same, but 'note' is only displayed when in verbose mode.
  Which is great to avoid unnecessary noise in Jenkins.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0f0bfcad7c1cfd2ce9baff8ed3cd6208bfe52b04)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2 years agoBug 29754: Don't include patron when fetching guarantees fines
Nick Clemens [Wed, 22 Dec 2021 15:25:44 +0000 (15:25 +0000)]
Bug 29754: Don't include patron when fetching guarantees fines

This patch removes the flag to fetch the patrons own debts as we have already
calculated them

This test plan highlights another issue - the value of NoIssuesChargeGuarantorsWithGuarantees
is not checked in SIP code - we merely get the total owed including guarantees and compares to
noissuescharge
See bug 29755

To test:
 1 - Apply first patch only
 2 - prove t/db_dependent/SIP/Patron.t
 3 - It fails
 4 - Enable NoIssuesChargeGuarantorsWithGuarantees, you can set to 1
 5 - Create/find a patron
 6 - Add a $10 charge to parons account
 7 - Add a guarantee to patron
 8 - Add a $5 charge to guarantee
 9 - Set noissuescharge to 15.01
10 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron BARCODE
11 - Note the 64 message starts with Y's that mean patron is blocked
12 - Patron shouldn't be blocked as under 15.01
13 - Apply patch
14 - Restart all
15 - repeat 10
16 - Patron is no longer blocked

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fe59e356a3b2ea32b333d6c1d332468db61feeec)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>