koha.git
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>
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>
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>
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>
2 years agoBug 30003: Prevent double up of point-of-sale items
Jake Deery [Tue, 8 Feb 2022 11:40:06 +0000 (11:40 +0000)]
Bug 30003: Prevent double up of point-of-sale items

This patch prevents the double submission of point-of-sale items when form validation fails at the first submission

Test plan
 1.  Navigate to /cgi-bin/koha/pos/pay.pl
 2.  Add an item from 'items to purchase'
 3.  Under 'collect payment', click submit without altering the form
 4.  See 'This field is required.'
 5.  Now, fill a value in 'Amount tendered' that satisfies or exceeds 'Amount being paid'
 6.  The payment should succeed
 7.  Navigate to /cgi-bin/koha/pos/register.pl
 8.  See duplicate lines in Transactions
 9.  Apply patch
10.  Repeat 2-6
11.  Navigate to /cgi-bin/koha/pos/register.pl
12.  Confirm only a single line was added

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
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>
2 years agoBug 29576: (QA follow-up) Rename road type to street type to match patron form
Katrin Fischer [Sun, 27 Mar 2022 00:05:02 +0000 (00:05 +0000)]
Bug 29576: (QA follow-up) Rename road type to street type to match patron form

This changes the pref description so the field name matches what
we use in the patron form.

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>
2 years agoBug 34874: Add streettype and B_streettype to PrefillGuaranteeField
Didier Gautheron [Thu, 25 Nov 2021 14:39:14 +0000 (15:39 +0100)]
Bug 34874: Add streettype and B_streettype to PrefillGuaranteeField

To test :
 1) modify PrefillGuaranteeField system preference
 2) road type for main and alternate addresses aren't in the list
 3) Apply patch
 4) Redo 1, now they are

https://bugs.koha-community.org/show_bug.cgi?id=29576
Signed-off-by: The Minh Luong <the-minh.luong@inlibro.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>
2 years agoBug 30114: Koha offline circulation will always cancel the next hold when issuing...
Kyle Hall [Tue, 15 Feb 2022 16:33:33 +0000 (11:33 -0500)]
Bug 30114: Koha offline circulation will always cancel the next hold when issuing item to a patron

If a record has holds on it, and, using offline circulation, an item on
that is checked out to a patron that did not have a hold on the record,
the next hold that would have trapped that item will be canceled.

1) Place two bib level holds on an item for two patrons
2) Find a third patron, note his or her cardnumber
3) Create the file test.koc by copying and pasting the following into a
   text editor

Version=1.0 Generator=kocTest GeneratorVersion=0.7
2008-06-11 12:24:11 547 issue PATRONCARDNUMBER ITEMBARCODE

note the fields are tab delemited, ensure the tabs do not get lost
when copying and pasting!

4) Upload the offline circ action, and commit the action
5) Note the item was checked out to the third patron
6) Note one of the other patron's holds were canceled
7) Reset your database
8) Apply this patch
9) Test again, no hold should be canceled!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 30114: Add Unit Tests
Kyle Hall [Mon, 7 Mar 2022 14:07:14 +0000 (09:07 -0500)]
Bug 30114: Add Unit Tests

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>
2 years agoBug 29501: Use the default transport
Tomas Cohen Arazi [Mon, 21 Mar 2022 16:45:16 +0000 (13:45 -0300)]
Bug 29501: Use the default transport

This patch makes the script pass the default SMTP transport to the
->send_or_die call.

The default is picked as this is the current behavior. New enhancements
could add the *library_id* to the message_queue table, and allow using
different transports depending on that. But it is out of the scope of
this bug.

To test:
1. Verify messages are being sent.
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
JD amended patch: revert
-        unless $format =~ m[^html$|^csv$|^ods$];
+        unless $format =~ m/^html$|^csv$|^ods$/;
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>
2 years agoBug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency
Tomas Cohen Arazi [Tue, 8 Mar 2022 11:36:56 +0000 (11:36 +0000)]
Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency

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>
2 years agoBug 29501: Remove MIME::Lite dependency
Tomas Cohen Arazi [Thu, 18 Nov 2021 12:41:44 +0000 (09:41 -0300)]
Bug 29501: Remove MIME::Lite dependency

The library usage is discouraged by the current maintainer and we don't
use it in the codebase anymore.

To test:
1. Apply this patch
2. Run:
   $ git grep MIME::Lite
=> SUCCESS: No uses of the removed library
3. Sign off :-D

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>
2 years agoBug 29501: Make gather_print_notices.pl use Koha::Email
Tomas Cohen Arazi [Thu, 18 Nov 2021 12:40:22 +0000 (09:40 -0300)]
Bug 29501: Make gather_print_notices.pl use Koha::Email

This patch makes the cronjob script use Koha::Email and thus relying on
configured SMTP settings instead of just trying localhost.

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>
2 years agoBug 30393: Make datatables wrapper handle searching for %, _, \
Tomas Cohen Arazi [Wed, 30 Mar 2022 10:10:26 +0000 (12:10 +0200)]
Bug 30393: Make datatables wrapper handle searching for %, _, \

This patch makes searching for '%','_' and '\' work by escaping those
symbols in the query before sending them to the API.

To test:
1. Go to the cities page
2. Add two cities:
   - 'Cordoba %'
   - 'Buenos Aires _'
   - 'London \'
3. Use the column search on the name, alternating _, \ and % as the query
=> FAIL: Weird behavior
4. Apply this patch and reload
5. Repeat 3
=> SUCCESS: Filtering works correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
2 years agoBug 30244: Include lost items in list of hidden items
Nick Clemens [Fri, 11 Mar 2022 14:24:27 +0000 (14:24 +0000)]
Bug 30244: Include lost items in list of hidden items

When building search results for XSLT we generate and pass a list of hidden
itemnumbers.

We do skip the lost items in our parsing, however, we neglect to add the itemnumber
to the hidden list

This patch simply adds the lost itemnumbers to the list

There is more work to be done here to simpliofy this process, however, this patch resolves
the issue and can be backported to stable branches

To test:
1 - Set systempreference hidelostitems to "Don't show"
2 - Edit a record to set one item as lost and one as available
3 - Perform an OPAC search that returns the record above
4 - Note that the lost item shows in availability line
5 - Click on the record - note the lost item does not show on details
6 - Apply patch
7 - Reload search results
8 - Lost itme no longer displays

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>
2 years agoBug 30175: Toggle digest boxes when loading messaging preferences
Nick Clemens [Thu, 24 Feb 2022 12:12:27 +0000 (12:12 +0000)]
Bug 30175: Toggle digest boxes when loading messaging preferences

To test:
1 - Define default messaging preferences for a patron category, checking a transport and the digest only boxes
2 - Create a new patron of a different category
3 - Change the category to the one set above
4 - Note that checkboxes are checked, but digest boxes are disabled
5 - Save patron - the digest boxes are not saved
6 - Apply patch
7 - Repeat 2&3
8 - Note checkboxes for digest are checked and enabled
9 - Save patron and confirm options are saved

Signed-off-by: Lucas Gass <lucas@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>
2 years agoBug 30251: (bug 10902 follow-up) With IndependentBranches non-superlibrarians do...
Janusz Kaczmarek [Tue, 8 Mar 2022 21:42:44 +0000 (22:42 +0100)]
Bug 30251: (bug 10902 follow-up) With IndependentBranches non-superlibrarians do not get autocomplete list in circulation module

Having IndependentBranches on, a librarian who is not superlibrarian
does not get a autocomplete hint list when entering a part of the
patron's name (while performing check out, etc.)  Koha registers
an error:

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Column 'branchcode' in where clause is ambiguous at
.../Koha/Objects.pm line 312

This is due to fix to the bug 10902 -- addig "prefetch => 'branchcode'" to
the attributes of the query in circ/ysearch.pl, while having branchcode
in the search parameters.

Test plan:
----------

1. Have IndependentBranches on, PatronAutoComplete set to 'Try.
   Be a librarian without superlibrarian privileges.  Have some
   patrons defined.
2. In the main input field on the top, with Check out active, try to
   put 3+ characters from the known user name/cardnumber etc. You
   will get no hint.
3. Apply the patch.
4. Repeat 2.  You should now see an autocomplete hint list.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
2 years agoBug 29103: Change desk when checking in a waiting reserve
Nicolas Legrand [Tue, 18 Jan 2022 10:45:50 +0000 (10:45 +0000)]
Bug 29103: Change desk when checking in a waiting reserve

A check in should relocate a waiting hold under the current desk. But
the current behaviour when confirming the hold is to dismiss the
modal, the item is still attached to the preceding desk.

This patch mimicks the print and confirm behaviour to trigger the desk
change.

Plan test:

1. Add some desks to you library (syspref UseCirculationDesks and
   Administration -> Patrons and circulation -> Circulation desks.

2. Set a desk in your session (Circulation -> Set library and desk)

3. Have some waiting hold attach to a desk (make a hold on a checked
   out item and return it).

4. Change your current desk.

5. Check in again the item, click on confirm.

6. Go to the item notice detail, it appears as waiting at your first
   desk.

7. Apply patch.

8. Check in again the item.

9. go to the item notice detail, it should appear at your current
   desk.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
2 years agoBug 30165: (follow-up) Allow objects.search usage outside OpenAPI
Tomas Cohen Arazi [Thu, 24 Mar 2022 12:52:04 +0000 (09:52 -0300)]
Bug 30165: (follow-up) Allow objects.search usage outside OpenAPI

Our objects.search helper is written for being used in our API
controllers, which get their query parameters processed by the OpenAPI
plugin, using JSON::Validator.

Particularly, the 'q' parameter is defined as 'multi' on our spec, which
means objects.search always gets it as an arrayref.

As the Objects.t tests are not using the OpenAPI plugin, a hashref is
generated as only one q= is being passed. This patch adds an extra
validation on objects.search, for the non-arrayref use case and does the
right thing.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Tests fail!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

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>
2 years agoBug 30110: Fix concatenation during assignements
Jonathan Druart [Mon, 21 Feb 2022 09:50:55 +0000 (10:50 +0100)]
Bug 30110: Fix concatenation during assignements

There are several occurrences of `my $var += ` or .= in the code.
It should not cause problems but it's confusing.

Test plan:
Read the patch and confirm that the changes make sense.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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>
2 years agoBug 30199: Do not generate jwt if patron does not exist
Jonathan Druart [Fri, 18 Mar 2022 09:26:48 +0000 (10:26 +0100)]
Bug 30199: Do not generate jwt if patron does not exist

This is a follow-up patch for bug 29543. If an invalid cardnumber has
been used we should not generate a token.

Test Plan:
1. Set SelfCheckoutByLogin to 'cardnumber'.
2. Go to http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
3. Enter an invalid carnumber like 'thisisabadcardnumber'
4. See the appropriate message "Sorry The userid thisisabadcardnumber was not found in the database. Please try again."
5. Try again with a different cardnumber and notice the same exact error message including the 'thisisabadcardnumber' cardnumber.
6. Apply this patch
7. Restart all the things!
8. Repeat steps 2-4
9. Try again with a different cardnumber, you should now see the correct
   cardnumber!

Signed-off-by: Lucas Gass <lucas@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>
2 years agoBug 25251: (follow-up) Remove alertNoItems
Nick Clemens [Tue, 22 Mar 2022 11:40:07 +0000 (11:40 +0000)]
Bug 25251: (follow-up) Remove alertNoItems

We should not need this function any longer

I left the else conditional just in case

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>
2 years agoBug 25251: Remove alert from disabled buttons
Nick Clemens [Mon, 14 Mar 2022 17:05:56 +0000 (17:05 +0000)]
Bug 25251: Remove alert from disabled buttons

This patch removes the alert, but adds a stopPropagation call
in order to not close the menu when the disabled buttons are clicked

To test:
1 - Find a record with items in the staff interface
2 - Click edit
3 - Note 'Edit items in a batch, 'Delete items in a batch', and 'Delete
    all items' are grayed out
4 - Note hovering displays a note that there are no items
5 - Click on each anyway, an alert is generated, menu is closed
6 - Apply patch
7 - Reload page
8 - Click on each disabled option and confirm
    - there is no more alert
    - the menu does not close
9 - Confirm tooltip is displayed

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>
2 years agoBug 30282: overdues report does not display subtitle, part_name, part_number
Blou [Fri, 11 Mar 2022 20:54:51 +0000 (15:54 -0500)]
Bug 30282: overdues report does not display subtitle, part_name, part_number

In circ/overdue.pl, the Title column is the result of includes/biblio-title.inc display.  The code of biblio-title.inc means to display subtitle, part_number and part_name from biblio table, but nothing but commas show up because those fields are never retrieved by overdue.pl

To reproduce:
1) have an item whose biblio.subtitle, part_name and part_number and non-empty.
2) issue it, then set it late (overdue).
3) go to the report page (circ/overdue.pl) and make it appear.
4) subtitle, part_number and part_name do not appear, although they are meant to by biblio-title.inc code
5) apply the patch and try again.

It's a simple fix of adding the fields in the database query.

Signed-off-by: Lucas Gass <lucas@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>
2 years agoBug 29893: Redraw the tables from other tabs without paging
Jonathan Druart [Thu, 17 Feb 2022 16:39:52 +0000 (17:39 +0100)]
Bug 29893: Redraw the tables from other tabs without paging

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29893: Make sure the form will be submitted after the draw calls
Jonathan Druart [Wed, 9 Feb 2022 10:07:40 +0000 (11:07 +0100)]
Bug 29893: Make sure the form will be submitted after the draw calls

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29893: Prevent ES mappings UI to remove hidden rows
Jonathan Druart [Mon, 17 Jan 2022 14:45:06 +0000 (15:45 +0100)]
Bug 29893: Prevent ES mappings UI to remove hidden rows

If you are editing ES mappings and you use the DataTable filtering option,
the table won't contain all the mappings you have in the DB.
If the form is submitted they will be removed and data will be lost!

Test plan:
Edit ES mappings, filter and submit the form.
Confirm that the table are redrawn before the form submission which
prevent data loss

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>
Signed-off-by: Kyle M Hall <kyle@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>
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>
2 years agoBug 29802: add 'me' to filter_by_visible_in_opac query
Nick Clemens [Fri, 18 Mar 2022 14:25:14 +0000 (14:25 +0000)]
Bug 29802: add 'me' to filter_by_visible_in_opac query

This patch prefixes all of the fields in OpacHiddenItems with
"me." before searching.

Unit tests added to cover this case1

To test:
1 - Create a public list
2 - Set OpacHiddenItems to:
    biblionumber: [1]
3 - Attempt to view list in OPAC
4 - Booom
5 - Aply patch
6 - Reload list
7 - Success

Signed-off-by: Fridolin Somers <fridolin.somers@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>
2 years agoBug 29802: Unit tests
Nick Clemens [Thu, 6 Jan 2022 16:03:56 +0000 (16:03 +0000)]
Bug 29802: Unit tests

prove -v t/db_dependent/Koha/Items.t
prove -v t/db_dependent/XSLT.t

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>
2 years agoBug 26685: Move Starman out of debian/control.in and into cpanfile (2)
Mason James [Wed, 2 Mar 2022 05:30:49 +0000 (18:30 +1300)]
Bug 26685: Move Starman out of debian/control.in and into cpanfile (2)

defining package as 'recommended', as suggested

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>
2 years agoBug 26685: Move starman out of debian/control.in and into cpanfile
David Cook [Thu, 15 Oct 2020 02:06:44 +0000 (02:06 +0000)]
Bug 26685: Move starman out of debian/control.in and into cpanfile

to test...
 - apply patch
 - build and install new package
 - confirm starman package displays correctly in about.pl page

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30161: Remove duplicate z3950_search include
Marcel de Rooy [Wed, 23 Feb 2022 13:14:03 +0000 (13:14 +0000)]
Bug 30161: Remove duplicate z3950_search include

Speaks for itself.

Test plan:
Check if the acqui z3950 search works as expected.

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: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30253: Remove a double mana_success parameter
Marcel de Rooy [Wed, 9 Mar 2022 12:46:10 +0000 (12:46 +0000)]
Bug 30253: Remove a double mana_success parameter

Remove the line without the scalar.

Test plan:
Just look at the code.

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: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30008: (bug 29690 follow-up) Fix Invalid data, cannot decode metadata object
Jonathan Druart [Thu, 17 Mar 2022 15:19:16 +0000 (16:19 +0100)]
Bug 30008: (bug 29690 follow-up) Fix Invalid data, cannot decode metadata object

Test plan:
1 - Find a record in the staff catalog
2 - Edit the record
3 - In the 520 notes field, add an ASCII escape character (27 decimal, 1b hex)
    On ubuntu Ctrl+Shift+u, then 1b, enter
4 - Save the record
5 - Set syspref ShowComponentRecords to 'both...'
6 - On record details: New->New child record
7 - Save the record
8 - Attempt to view the parent record in the staff client and opac

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
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>
2 years agoBug 29940: Don't surround value by quote
Jonathan Druart [Thu, 27 Jan 2022 14:30:17 +0000 (15:30 +0100)]
Bug 29940: Don't surround value by quote

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
2 years agoBug 29940: Phase out jquery.cookie.js in the OPAC
Owen Leonard [Tue, 25 Jan 2022 12:32:28 +0000 (12:32 +0000)]
Bug 29940: Phase out jquery.cookie.js in the OPAC

This patch replaces the use of jquery.cookie.js in the OPAC with the
newer js-cookie plugin. The patch adds the latest version of the
js-cookie library and removes the old jquery.cookie plugin.

To test, apply the patch and go to the advanced search page in the OPAC.

- Perform a search using a number of different limits and settings, e.g.
  keyword, item type, and sort-by.
- On the search results page you should see at the top of the results
  list a link to "Return to the last advanced search."
- The link should take you back to the advanced search page with all the
  same settings filled into the form.
- A search with the "More options" view enabled in the advanced search
  form should result in a link which returns to the "More options" view.
- Searching via the "quick search" form at the top of the page should
  clear the cookies which were set in order to remember the advanced
  search. See
  https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
  information on viewing your browser's stored cookies.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
2 years agoBug 30266: Hide pickup location input on waiting hold
Nick Clemens [Thu, 10 Mar 2022 12:23:42 +0000 (12:23 +0000)]
Bug 30266: Hide pickup location input on waiting hold

This patch updates the holds table to always insert a hidden input when a hold is 'found'
and covers the case where the hold is 'found' but doesn't match known statuses

To test:
 1 - Place two holds on a record for two different patrons, with different pickup locations
 2 - Check in one item at expected branch to set waiting
 3 - Then either:
    - Use batch modification or item editor to change the holding branch for the item
    - Sign in to a different branch and manually transfer the item back to it's home location
 4 - View the holds for the record
 5 - Note the 'Pickup library' column is blank for that hold
 6 - Change pickup location for other hold and press 'Update holds'
 7 - Note the waiting hold is still blank, and now second hold has no pickup location
 8 - Check the DB and note the first hold has had the pickup location changed
 8 - Apply patch
 9 - Delete holds and repeat 1-4
10 - Note the waiting hold now displays:
    Hold expected at {Branch}, please checkin to verify status
11 - Change location for second hold and update holds
12 - COnfirm location chanegd correctly and first hold unaffected

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>
2 years agoBug 30004: Prevent TooMany from executing too many SQL queries
Julian Maurice [Wed, 2 Feb 2022 12:53:48 +0000 (13:53 +0100)]
Bug 30004: Prevent TooMany from executing too many SQL queries

If a maximum number of checkouts allowed is defined in circulation
rules, C4::Circulation::TooMany will loop over all patron's checkouts.
When a patron has several hundreds of checkouts, it can really slow down
the checkout process by several seconds (or even tens of seconds)

This patch does two things:
- Always prefetch item data so that `$c->item` does not execute an
  additional SQL query at every iteration of the loop. Item data is
  always needed at the first line of the loop, so there is really no
  downside for doing this.
- Build the `@types` array only once, out of the checkouts loop. Since
  it does not depend at all on patron's checkouts data, it does not make
  sense to build it inside the loop.

Test plan:
1. Before applying the patch, create a patron with a lot of checkouts.
   I tested with 1000 checkouts, but the slowness should be noticeable
   with less.
2. Make sure you have a circulation rule (one that apply to your patron
   and the item(s) you will check out for testing) with a maximum number
   of checkouts allowed
3. Check out an item for the patron with a lot of checkouts. Measure the
   time it takes.
4. Apply the patch
5. Check out another item (or check in and then check out the same item
   used in step 3). Measure the time it takes and compare it to step 3.
   It should be faster now.
6. Run `prove t/db_dependent/Circulation/TooMany.t`

Signed-off-by: Nick Clemens <nick@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>
2 years agoBug 30183: Fetch flatPickr instance prior to custom search definition
Martin Renvoize [Mon, 14 Mar 2022 14:32:31 +0000 (14:32 +0000)]
Bug 30183: Fetch flatPickr instance prior to custom search definition

This patch updates teh search customisations in ill-list-table to
properly fetch the existing flatpickr instances for date searches.

To test:
1. Have at least one ILL request on the ILL requests page
2. Open the broser inspector
3. Choose a date on the left hand form
=> FAIL: Errors in the console, search doesn't work
4. Apply this patch
5. Reload
6. Repeat 2-3
=> SUCCESS: No more errors, filtering works!
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 30325: (Bug 30098 follow-up) Fix broken patron search redirect when one result
Fridolin Somers [Mon, 21 Mar 2022 22:18:57 +0000 (12:18 -1000)]
Bug 30325: (Bug 30098 follow-up) Fix broken patron search redirect when one result

Bug 30098 fixed patron search behavior when a later page has only 1 result, but broke the redirect when there is only a single result from search.

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 - On third page you remain in results and are not redirected
4 - Perform a patron search that return only 1 result, name or cardnumber
5 - You get redirected to this patron page

Signed-off-by: Nick Clemens <nick@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>
2 years agoBug 30165: (follow-up) Fix GET /acquisitions/orders
Tomas Cohen Arazi [Tue, 15 Mar 2022 18:18:22 +0000 (15:18 -0300)]
Bug 30165: (follow-up) Fix GET /acquisitions/orders

This patch fixes the particular use case of the orders route, which has
a slightly modified version of the objects.search helped, embeded in the
controller itself. This controller gets adjusted to the fact q will now
be an array.

Because of the latter, we end up requiring more code duplication
regarding the query fix, so I moved it to an internal sub that gets
reused.

To test:
1. Apply the previous patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/*
=> FAIL: It t/db_dependent/api/v1/acquisitions_orders.t fails!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 30165: Make q parameter 'multi'
Tomas Cohen Arazi [Tue, 15 Mar 2022 12:42:19 +0000 (09:42 -0300)]
Bug 30165: Make q parameter 'multi'

This patch changes the q_param definition so the defined query parameter
is repeatable. This way JSON::Validator will always generate an arrayref
for it and won't skip occurences.

The objects.search helper is updated to always consider the 'q'
parameter as an array, as expected.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 30165: Regression tests
Tomas Cohen Arazi [Fri, 25 Feb 2022 11:45:26 +0000 (08:45 -0300)]
Bug 30165: Regression tests

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>
2 years agoBug 25285: Fix wrong message about required Koha version in plugins
Tomas Cohen Arazi [Wed, 9 Mar 2022 11:23:38 +0000 (08:23 -0300)]
Bug 25285: Fix wrong message about required Koha version in plugins

When you install a plugin that requires a newer Koha version, it reports
this:

<<
Warning: This report was written for a newer version of Koha. Run at your own risk.
>>

It is wrong in a couple ways:
- It is not a report.
- It feels like it dates back to when plugins were only run i.e.
  pre-hooks, etc.

This patch proposes a change to reflect this.

To test:
1. Verify the string changes make sense to you
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@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>
2 years agoBug 30214: (QA follow-up) Clarify code comment
Katrin Fischer [Sun, 6 Mar 2022 12:19:34 +0000 (12:19 +0000)]
Bug 30214: (QA follow-up) Clarify code comment

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>
2 years agoBug 30214: Add ACCTDETAILS notice to verified self registration
Martin Renvoize [Wed, 2 Mar 2022 16:14:18 +0000 (16:14 +0000)]
Bug 30214: Add ACCTDETAILS notice to verified self registration

This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, with varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
varified.

Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is enabled
4) Register a new user via the opac self registration process using an
   email address you have access to
5) Verify the user by following the link in the verification email you
   should have received.
6) The new user should have been created and you should be able to see
   the account details notice in their associated notices
7) Confirm that the email address used above has received the notice.

Signed-off-by: Owen Leonard <oleonard@myacpl.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>
2 years agoBug 30214: Add ACCTDETAILS notice to self registeration
Martin Renvoize [Wed, 2 Mar 2022 16:03:55 +0000 (16:03 +0000)]
Bug 30214: Add ACCTDETAILS notice to self registeration

This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, without varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
created.

Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is disabled
4) Register a new user via the opac self registration process using an
   email address you have access to
5) The new user should have been created and you should be able to see
   the account details notice in their associated notices
6) Confirm that the email address used above has received the notice.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17648: (QA follow-up) Restore imediate sending of the notice
Martin Renvoize [Tue, 1 Mar 2022 16:47:52 +0000 (16:47 +0000)]
Bug 17648: (QA follow-up) Restore imediate sending of the notice

The original notice was sent using SendAlerts, which triggers
immediately on submission and doesn't wait for the cron task.

This patch restores that immediacy and also fixes a bug in the imports
on the original patch.

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>
2 years agoBug 17648: (QA follow-up) Further code cleaning
Martin Renvoize [Tue, 1 Mar 2022 16:24:55 +0000 (16:24 +0000)]
Bug 17648: (QA follow-up) Further code cleaning

We actually have a Koha::Patron method to do all the work of finding the
right patron primary email address for notices.. we can use that here
instead of doing it long hand.

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>
2 years agoBug 17648: ACCTDETAILS notice does not show in notices.pl
Kyle Hall [Mon, 28 Feb 2022 14:03:29 +0000 (09:03 -0500)]
Bug 17648: ACCTDETAILS notice does not show in notices.pl

The ACCTDETAILS notice apparently bypasses message_queue; notices are sent directly to the linux mail queue.

Test Plan:
1) Apply this patch
2) Create a new patron with an email address
3) Note the patron's ACCTDETAILS notice shows in the patron's messages

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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>
2 years agoBug 27812: DBRev 21.04.002
Kyle Hall [Fri, 25 Mar 2022 13:31:12 +0000 (09:31 -0400)]
Bug 27812: DBRev 21.04.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27812: (QA follow-up) Fix atomicupdate
Martin Renvoize [Tue, 1 Mar 2022 16:00:10 +0000 (16:00 +0000)]
Bug 27812: (QA follow-up) Fix atomicupdate

We removed a bit too much from the skeliton here ;)

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>
2 years agoBug 27812: Add DBRev to warn of the change to the account details notice
Kyle Hall [Mon, 28 Feb 2022 13:30:07 +0000 (08:30 -0500)]
Bug 27812: Add DBRev to warn of the change to the account details notice

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>
2 years agoBug 27812: Email should send for all new patron as per the syspref description
Kyle M Hall [Mon, 5 Apr 2021 12:33:38 +0000 (08:33 -0400)]
Bug 27812: Email should send for all new patron as per the syspref description

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>
2 years agoBug 27812: Remove the ability to transmit a patron's plain text password over email
Kyle M Hall [Fri, 26 Feb 2021 18:16:58 +0000 (13:16 -0500)]
Bug 27812: Remove the ability to transmit a patron's plain text password over email

We should not give libraries the ability to compromise patron accounts,
it is considered a huge security issue and nobody in network security
would never recommend allowing passwords to be transmitted in clear text
over email.

It should simply not be possible to send a patron's password in plain text
via email. As such, we should remove this ability from Koha.

Test Plan:
1) Apply this patch
2) Create a patron to generate the ACCTDETAILS email
3) Note you can no longer transmit the patron's password in the email

Signed-off-by: Amit Gupta <amitddng135@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>
2 years agoBug 30177: When editing an existing patron set message_prefs_dirty to true
Lucas Gass [Thu, 24 Feb 2022 16:17:11 +0000 (16:17 +0000)]
Bug 30177: When editing an existing patron set message_prefs_dirty to true

1 - Define default messaging preferences for a patron category
2 - Go into an existing account and change the patron category to the
    one set in step 1.
3 - Confirm that the messaging prefs have been reset to that of the
    default patron category
4 - Apply patch
5 - Repeat Step 2, this time you should see a warning asking if you want
    to set messaging prefs to the category default
6 - Press OK and save. Confirm that the messaging prefs are now set to
    the default for that category
7 - Try it again with an existing account and press Cancel this time.
    Notice that there should be no change to the patron messaging prefs.
8 - Try making a new patron and switching the category, you should see
    no warning and the message prefs should be proberly set to the
    defaults of any category you choose.

Signed-off-by: Owen Leonard <oleonard@myacpl.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>
2 years agoBug 30212: Make Select2 available for ILL backends
Tomas Cohen Arazi [Wed, 2 Mar 2022 11:19:55 +0000 (08:19 -0300)]
Bug 30212: Make Select2 available for ILL backends

This patch makes select2 available for ILL backend developers to use on
their templates.

To test:
1. Have a configured backed and an ILL request
2. Open the inspector and load any action on the backend (intranet)
=> FAIL: no select2 asset is transfered from Koha to the browser
3. Apply this patch
4. Reload
=> SUCCESS: There's select2
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 30155: Don't get items that can fillholds if there are no holds
Nick Clemens [Tue, 22 Feb 2022 16:54:03 +0000 (16:54 +0000)]
Bug 30155: Don't get items that can fillholds if there are no holds

This makes two changes:
1 - We no longer call get_items_that_can_fill if there are no holds
2 - The subroutine will return an empty Koha::Items object if there are no holds passed

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>
2 years agoBug 30252: lower version of 'Locale::XGettext::TT2' to 0.6
Mason James [Wed, 9 Mar 2022 04:22:50 +0000 (17:22 +1300)]
Bug 30252: lower version of 'Locale::XGettext::TT2' to 0.6

this patch reduces the required version of 'Locale::XGettext::TT2' to 0.6

version 0.7 of of Locale::XGettext::TT2 is incompatible with the current version of libintl-perl (1.26), so we use 0.6 instead

 https://packages.debian.org/stretch/libintl-perl
 https://metacpan.org/release/GUIDO/Template-Plugin-Gettext-0.6/view/lib/Locale/XGettext/TT2.pm

we will move to 'Locale::XGettext::TT2' 0.7 when libintl-perl-1.32 arrives
 https://tracker.debian.org/pkg/libintl-perl

small change, no test plan

Signed-off-by: Mason James <mtj@kohaaloha.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>
2 years agoBug 29684: (QA follow-up) add lost borrower_data. prefix in memberentrygen.tt for...
Andrew Nugged [Thu, 10 Feb 2022 23:16:22 +0000 (01:16 +0200)]
Bug 29684: (QA follow-up) add lost borrower_data. prefix in memberentrygen.tt for: - primary_contact_method - autorenew_checkouts - sort1 - sort2

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>
2 years agoBug 29684: (QA follow-up) paycollect.pl don't needs borrower_data at all
Andrew Nugged [Wed, 9 Feb 2022 23:16:23 +0000 (01:16 +0200)]
Bug 29684: (QA follow-up) paycollect.pl don't needs borrower_data at all

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>
2 years agoBug 29684: (QA follow-up) Remove 2 extra 'borrower_data.' prefixes
Andrew Nugged [Wed, 9 Feb 2022 22:46:47 +0000 (00:46 +0200)]
Bug 29684: (QA follow-up) Remove 2 extra 'borrower_data.' prefixes

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>
2 years agoBug 29684: add honeypot to catch other warnings in the future
Petro Vashchuk [Mon, 17 Jan 2022 14:38:53 +0000 (16:38 +0200)]
Bug 29684: add honeypot to catch other warnings in the future

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29684: Fix warn about js/locale_data.js (paycollect.pl)
Petro Vashchuk [Mon, 17 Jan 2022 14:31:08 +0000 (16:31 +0200)]
Bug 29684: Fix warn about js/locale_data.js (paycollect.pl)

To reproduce (paycollect.pl):
1) Prepare or use some existing patron with outstanding fines, go to
the accounting section and open page where you make payment towards all
fines.
2) The error message should have appeared in your log file about
"File not found : default/js/locale_data.js".
3) Apply the patch.
4) Open the edit page again, ensure that the new error massage like
that didn't appear.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29684: Fix warn about js/locale_data.js (memberentry.pl)
Petro Vashchuk [Mon, 17 Jan 2022 14:17:51 +0000 (16:17 +0200)]
Bug 29684: Fix warn about js/locale_data.js (memberentry.pl)

To reproduce (memberentry.pl):
1) Head over to the patron details page, press edit button to open the
memberentry.pl page.
2) The error message should have appeared in your log file about
"File not found : default/js/locale_data.js".
3) Apply the patch.
4) Open the edit page again, ensure that the new error massage like
that didn't appear.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
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>
2 years agoBug 30159: (QA follow-up) Fix translatability of alert message
Katrin Fischer [Sun, 6 Mar 2022 13:54:54 +0000 (14:54 +0100)]
Bug 30159: (QA follow-up) Fix translatability of alert message

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>
2 years agoBug 30159: (follow-up) Make warning messages consistent
Adam Styles [Wed, 23 Feb 2022 23:20:51 +0000 (10:20 +1100)]
Bug 30159: (follow-up) Make warning messages consistent

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>
2 years agoBug 30159: Fix Check() to validate both mandatory and important fields
Adam Styles [Tue, 22 Feb 2022 00:32:52 +0000 (11:32 +1100)]
Bug 30159: Fix Check() to validate both mandatory and important fields

This patch adds a check for both mandatory and important fields when
validating bibliographic records during cataloguing.

To test:

1. Go to Admin -> Biblio frameworks. View the MARC structure of your
   default framework.
2. Search for tag 082. Edit the subfields for this tag.
3. Check the 'important' checkbox for subfield a and Save.
4. Go to add or edit a new biblio record under Cataloguing.
5. Ensure the 082$a field is empty and hit Save.
6. Notice the confirmation pop-up is an unreadable display of HTML.
7. Click Cancel on the pop-up box.
8. Apply the patch and refresh the editor page.
9. Ensure the 082$a field is empty and hit Save.
10. Notice the confirmation pop-up is more helpful this time. Click
    Cancel on the pop-up box.
11. Notice the 082$a field is displayed at the top of the page as an
    important field that is missing information. Use the 'go to field'
    link and confirm this works as expected.
12. Leave 082$a empty and hit Save.
13. This time click OK on the confirmation pop-up. Confirm you are able
    to save your record as normal.

Sponsored-by: Education Services Australia SCIS
Signed-off-by: Owen Leonard <oleonard@myacpl.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>
2 years agoBug 29596: DBRev 21.11.04.001 v21.11.04-1
Kyle M Hall [Fri, 25 Mar 2022 12:14:27 +0000 (12:14 +0000)]
Bug 29596: DBRev 21.11.04.001

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>
2 years agoUpdate Koha.pm version to 21.11.04.000 v21.11.04
Kyle M Hall [Fri, 25 Mar 2022 10:27:23 +0000 (06:27 -0400)]
Update Koha.pm version to 21.11.04.000

2 years agoUpdate release notes for 21.11.04 again
Kyle M Hall [Thu, 24 Mar 2022 18:23:43 +0000 (18:23 +0000)]
Update release notes for 21.11.04 again

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoMerge remote-tracking branch 'security/21.11.x' into 21.11.x
Kyle M Hall [Thu, 24 Mar 2022 18:19:19 +0000 (14:19 -0400)]
Merge remote-tracking branch 'security/21.11.x' into 21.11.x

2 years agoUpdate release notes for 21.11.04
Kyle Hall [Thu, 24 Mar 2022 18:04:14 +0000 (14:04 -0400)]
Update release notes for 21.11.04

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
2 years agoIncrement version for 21.11.04 release
Kyle Hall [Thu, 24 Mar 2022 17:53:41 +0000 (13:53 -0400)]
Increment version for 21.11.04 release

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
2 years agoFix translations for Koha 21.11.04
Kyle Hall [Thu, 24 Mar 2022 17:52:23 +0000 (13:52 -0400)]
Fix translations for Koha 21.11.04

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
2 years agoTranslation updates for Koha 21.11.04
Koha translators [Thu, 24 Mar 2022 16:15:45 +0000 (13:15 -0300)]
Translation updates for Koha 21.11.04

2 years agoBug 29915: (QA follow-up) Spelling
Martin Renvoize [Wed, 16 Mar 2022 14:07:23 +0000 (14:07 +0000)]
Bug 29915: (QA follow-up) Spelling

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Add selenium tests
Jonathan Druart [Fri, 28 Jan 2022 16:12:04 +0000 (17:12 +0100)]
Bug 29915: Add selenium tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Add a note for tests
Jonathan Druart [Thu, 27 Jan 2022 14:12:40 +0000 (15:12 +0100)]
Bug 29915: Add a note for tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: (QA follow-up) Add a comment in checkauth on $flags
Marcel de Rooy [Wed, 26 Jan 2022 15:54:28 +0000 (15:54 +0000)]
Bug 29915: (QA follow-up) Add a comment in checkauth on $flags

This is quite a misleading call.

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Changes to Auth.t
Marcel de Rooy [Wed, 26 Jan 2022 12:27:56 +0000 (12:27 +0000)]
Bug 29915: Changes to Auth.t

Test plan:
Run Auth.t

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Add tests
Jonathan Druart [Wed, 26 Jan 2022 10:58:33 +0000 (11:58 +0100)]
Bug 29915: Add tests

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: (QA follow-up) Fix POD typo
Marcel de Rooy [Tue, 25 Jan 2022 14:52:31 +0000 (14:52 +0000)]
Bug 29915: (QA follow-up) Fix POD typo

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Tiny session adjustments
Marcel de Rooy [Tue, 25 Jan 2022 13:55:00 +0000 (13:55 +0000)]
Bug 29915: Tiny session adjustments

It may be that we need a few additional flushes.
And checking the returned session before clearing busc.

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Changes for get_session and check_cookie_auth
Marcel de Rooy [Mon, 24 Jan 2022 13:08:01 +0000 (13:08 +0000)]
Bug 29915: Changes for get_session and check_cookie_auth

If we look for an existing session, do not create a new one.
Found a bug in the unset_userenv calls. For this moment
changing the calls in Auth here. Later fix goes to bug
29954.

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29915: Don't generate a new session ID for anonymous navigation
Jonathan Druart [Thu, 20 Jan 2022 11:05:11 +0000 (12:05 +0100)]
Bug 29915: Don't generate a new session ID for anonymous navigation

When a user is not logged in, a new session ID is generated every time a
new page is hit.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@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>
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>
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>
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>
2 years agoBug 30128: DBIC Schema update
Kyle Hall [Fri, 11 Mar 2022 11:35:03 +0000 (06:35 -0500)]
Bug 30128: DBIC Schema update

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30203: DBrev 21.11.03.001
Kyle Hall [Fri, 11 Mar 2022 11:25:59 +0000 (06:25 -0500)]
Bug 30203: DBrev 21.11.03.001

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30128: Change language_subtag_registry.description to varchar(255)
Fridolin Somers [Fri, 18 Feb 2022 06:37:13 +0000 (20:37 -1000)]
Bug 30128: Change language_subtag_registry.description to varchar(255)

In database, language_descriptions.description is VARCHAR(255).
language_subtag_registry.description is VARCH(25), it should have same size.

You can see in https://www.loc.gov/standards/iso639-2/php/code_list.php there is for example 'South American Indian languages'

Test plan :
1) Run atomic update
2) Check language_subtag_registry.description is now varchar(255)

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>
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>
2 years agoBug 30147: Fix modules usage in opac-detail.pl
Fridolin Somers [Fri, 25 Feb 2022 00:24:18 +0000 (14:24 -1000)]
Bug 30147: Fix modules usage in opac-detail.pl

On the ktd sample database when trying to go to the detail page from the result list:
Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_opac_opac_2ddetail_2epl::searchResults called at /kohadevbox/koha/opac/opac-detail.pl line 260
Turning off OpacBrowseResults makes the error disappear.

In opac-detail.pl, use C4::Search is missing searchResults and getRecords

To test:
- Search for something that gives several result pages in OPAC, example: e
- Switch to one of the last pages using link on top of results, example: 10
- Open any of the records listed in detail view
- Verify that the error is shown
- Apply patch and repeat, error is gone and browsing behaves as expected

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29826: Manage call of Template Plugin Branches GetName() with null or empty branc...
Fridolin Somers [Sat, 8 Jan 2022 01:34:49 +0000 (15:34 -1000)]
Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branchcode

Bug 26587 added a concatenation that sends a warning if var is undef :
$ prove t/db_dependent/Template/Plugin/Branches.t
Use of uninitialized value $branchcode in concatenation (.) or string at /kohadevbox/koha/Koha/Template/Plugin/Branches.pm line 35.

This patch adds an early return empty string when GetName is called with $branchcode null or empty string.

Test plan :
1) Run t/db_dependent/Template/Plugin/Branches.t without patch
2) Run with the patch to see warning disappear

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>