koha.git
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
2 years agoBug 20362: (follow-up) Direct link to authority records missing in staff detail view...
George Veranis [Thu, 24 Feb 2022 14:10:14 +0000 (15:10 +0100)]
Bug 20362: (follow-up) Direct link to authority records missing in staff detail view (1xx , 7xx)

I change the magnigying glass icon to FA icon in the staff detail view
for 1xx and 7xx of the record that links to the authority records.

The following test plan is for 100 tag only but the patch can be apply
for all 1xx and 7xx tags that can be connect with an authority record.

Test Plan:
1) On the Koha staff page, create a new authority. The type of authority
   will be: e.g Personal Name
2) When creating authority, in tab 1 under -HEADING--PERSONAL NAME enter
   the personal name term entry element and then save the
   new authority e.g. Twain, Mark.
3) In circulation, search the catalog for a random book. Click the title
   of the book and you will be taken to the book details.
4) Edit the record and in tab 1 , scroll down the - MAIN ENTRY--
   PERSONAL NAME and repeat this tag (the icon next to the title).
5) Edit the Personal name term entry element by clicking
   the button on the right of the bar.
6) In the Search main heading ($a only) enter your personal name term
   e.g. Twain, Mark.
7) Press search, and then in the table that pops up, click 'choose'.
8) Save your edits and the new personal name term will be in the 'By:'
   of the book details.
9) Notice that there is no magnifying glass icon.
10) Apply this patch
11) Notice that there is now a magnifying glass icon next to the
    personal name term.
12) Click on the magnifying glass and it will take you directly to the
    authorities records

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>
2 years agoBug 20362: Direct link to authority records missing in staff detail view (1xx , 7xx)
George Veranis [Tue, 11 Jan 2022 08:31:27 +0000 (09:31 +0100)]
Bug 20362: Direct link to authority records missing in staff detail view (1xx , 7xx)

I added a magnigying glass icon in the staff detail view for 1xx and 7xx
of the record that links to the authority records.

The following test plan is for 100 tag only but the patch can be apply
for all 1xx and 7xx tags that can be connect with an authority record.

Test Plan:
1) On the Koha staff page, create a new authority. The type of authority
   will be: e.g Personal Name
2) When creating authority, in tab 1 under -HEADING--PERSONAL NAME enter
   the personal name term entry element and then save the
   new authority e.g. Twain, Mark.
3) In circulation, search the catalog for a random book. Click the title
   of the book and you will be taken to the book details.
4) Edit the record and in tab 1 , scroll down the - MAIN ENTRY--
   PERSONAL NAME and repeat this tag (the icon next to the title).
5) Edit the Personal name term entry element by clicking
   the button on the right of the bar.
6) In the Search main heading ($a only) enter your personal name term
   e.g. Twain, Mark.
7) Press search, and then in the table that pops up, click 'choose'.
8) Save your edits and the new personal name term will be in the 'By:'
   of the book details.
9) Notice that there is no magnifying glass icon.
10) Apply this patch
11) Notice that there is now a magnifying glass icon next to the
    personal name term.
12) Click on the magnifying glass and it will take you directly to the
    authorities records

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>
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>
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>
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>
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>
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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29931: (follow-up) Fix svc/checkouts and return_claims too
Marcel de Rooy [Tue, 25 Jan 2022 12:21:42 +0000 (12:21 +0000)]
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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29931: (follow-up) Similar thing in opac-patron-image.pl
Marcel de Rooy [Mon, 24 Jan 2022 13:06:33 +0000 (13:06 +0000)]
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>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29931: Check cookie status before continuing
Marcel de Rooy [Mon, 24 Jan 2022 10:24:08 +0000 (10:24 +0000)]
Bug 29931: 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>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (RM follow-up) Fix recalls.old is default 0
Fridolin Somers [Tue, 15 Mar 2022 09:54:15 +0000 (23:54 -1000)]
Bug 19532: (RM follow-up) Fix recalls.old is default 0

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (RM follow-up) More use of system preference
Fridolin Somers [Tue, 15 Mar 2022 08:04:47 +0000 (22:04 -1000)]
Bug 19532: (RM follow-up) More use of system preference

When system preference is off, call no code related to Koha::Recalls.

Also add some missing module import.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (RM follow-up) Adapt also UNIMARC XSLT
Fridolin Somers [Tue, 15 Mar 2022 08:04:12 +0000 (22:04 -1000)]
Bug 19532: (RM follow-up) Adapt also UNIMARC XSLT

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (RM follow-up) Fix status finished renamed fulfilled
Fridolin Somers [Tue, 15 Mar 2022 08:01:10 +0000 (22:01 -1000)]
Bug 19532: (RM follow-up) Fix status finished renamed fulfilled

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: DBRev 21.12.00.018
Fridolin Somers [Tue, 15 Mar 2022 07:50:34 +0000 (21:50 -1000)]
Bug 19532: DBRev 21.12.00.018

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (RM follow-up) Update DBIC Schema
Fridolin Somers [Tue, 15 Mar 2022 06:54:20 +0000 (20:54 -1000)]
Bug 19532: (RM follow-up) Update DBIC Schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Fixing typo
Aleisha Amohia [Mon, 14 Mar 2022 10:52:46 +0000 (23:52 +1300)]
Bug 19532: (QA follow-up) Fixing typo

Introduced by: Bug 19532: (QA follow-up) Simplify resultset accessors

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) POD and import fixes
Tomas Cohen Arazi [Fri, 11 Mar 2022 14:37:10 +0000 (11:37 -0300)]
Bug 19532: (QA follow-up) POD and import fixes

This fixes some library imports and POD.

To test:
1. Apply this patch
2. Run the tests
=> SUCCESS: No change
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Simplify resultset accessors
Tomas Cohen Arazi [Fri, 11 Mar 2022 19:46:45 +0000 (16:46 -0300)]
Bug 19532: (QA follow-up) Simplify resultset accessors

This patch makes the different ->recalls accessors implemented on this
bug be more standard. This means:
- They don't do special things like default sorting or stripping out
  special parameters. That's all left to the caller and the methods are
  clean: they just return the related objects
- Useful filtering methods for Koha::Recalls resultsets are added. The
  only used one (in the end) was ->filter_by_current. It seems like a
  better approach, because it gives devs more control on how they want
  to chain things, and there's a single place in which to maintain the
  criteria of what is 'current' or 'finished'. This clearly makes the
  'old' column obsolete IMHO, at least in the use cases I found. This is
  covered by tests as well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Make recalls.status an ENUM
Tomas Cohen Arazi [Fri, 11 Mar 2022 15:20:18 +0000 (12:20 -0300)]
Bug 19532: Make recalls.status an ENUM

This patch makes the status attribute an ENUM, setting the default value
as 'requested' as well. The chosen names are easier to read than single
letters. Also, renamed F into fulfilled (this impacts methods names as
well). This is because 'finished' or 'completed' is more a synonym for
old => 1...

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Add the cron jobs to the cron files
Marcel de Rooy [Thu, 3 Mar 2022 15:07:32 +0000 (15:07 +0000)]
Bug 19532: (QA follow-up) Add the cron jobs to the cron files

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Move as_list to iterator based loop
Marcel de Rooy [Wed, 2 Mar 2022 15:24:46 +0000 (15:24 +0000)]
Bug 19532: (QA follow-up) Move as_list to iterator based loop

Adjusting both new cron jobs.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Fix fine calculation by inserting biblionumber
Marcel de Rooy [Wed, 2 Mar 2022 14:33:06 +0000 (14:33 +0000)]
Bug 19532: (QA follow-up) Fix fine calculation by inserting biblionumber

The fines cron job uses Getoverdues to pass issue info to CalcFine.
It took me a while to realize that the overdue hash does not contain
a biblionumber. When testing CalcFine, we pass an item hash that
does include one.

So what happened? $item->{biblionumber} is undefined when it comes from
Getoverdues and no recall overdue fine is calculated, only a regular one.

Simple fix (without any impact): Add a biblionumber to Getoverdues.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with fines.pl: recall fine applied now.
Ran some Circulation and Overdues unit tests.
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Fix few Koha::Recalls->search occurrences
Marcel de Rooy [Tue, 1 Mar 2022 14:00:27 +0000 (14:00 +0000)]
Bug 19532: (QA follow-up) Fix few Koha::Recalls->search occurrences

Due to the wantarray change, we should fix this call in list context.
We should either use an iterator now or append as_list.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fix for wantarray change and title-string
Aleisha Amohia [Sun, 27 Feb 2022 23:17:04 +0000 (12:17 +1300)]
Bug 19532: (follow-up) Fix for wantarray change and title-string

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Fixing unit tests
Marcel de Rooy [Fri, 25 Feb 2022 08:53:11 +0000 (08:53 +0000)]
Bug 19532: (QA follow-up) Fixing unit tests

(Trivial:) Number of tests in Koha/Item.t
Added a $patron object to resolve warnings like:
* Global symbol "$patron" requires explicit package name (did you forget to declare "my $patron"?) at t/db_dependent/Koha/Patron.t line 1064.
Fixed CanItemBeReserved call in Holds.t, number of tests adjusted

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fixes along recall workflow
Aleisha Amohia [Mon, 14 Feb 2022 18:55:36 +0000 (07:55 +1300)]
Bug 19532: (follow-up) Fixes along recall workflow

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (QA follow-up) Enable XSLT statuses translation
Marcel de Rooy [Fri, 22 Oct 2021 08:32:03 +0000 (08:32 +0000)]
Bug 19532: (QA follow-up) Enable XSLT statuses translation

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fix calls, tests, syspref settings, checks
Aleisha Amohia [Thu, 14 Oct 2021 03:54:36 +0000 (16:54 +1300)]
Bug 19532: (follow-up) Fix calls, tests, syspref settings, checks

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fixing tests and QA tools
Aleisha Amohia [Sun, 8 Nov 2020 21:19:11 +0000 (10:19 +1300)]
Bug 19532: (follow-up) Fixing tests and QA tools

And making reverted ajax message clearer

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fix undef recall_id preventing fulfillment of recall
Aleisha Amohia [Thu, 5 Nov 2020 21:42:08 +0000 (10:42 +1300)]
Bug 19532: (follow-up) Fix undef recall_id preventing fulfillment of recall

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fixing OPAC display and staff client errors
Aleisha Amohia [Wed, 28 Oct 2020 03:15:39 +0000 (16:15 +1300)]
Bug 19532: (follow-up) Fixing OPAC display and staff client errors

- fixes the displays of opac-recalls.pl and opac-recall.pl
- fix the error on Recalls to pull page
- fix JS error preventing Recalled link from showing in checkouts table
- fix cancelling of recall when checking out item

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fixing failing CalcFine.t test
Aleisha Amohia [Sun, 25 Oct 2020 04:35:26 +0000 (17:35 +1300)]
Bug 19532: (follow-up) Fixing failing CalcFine.t test

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) aria-hidden attr on OPAC, and more
Aleisha Amohia [Sat, 24 Oct 2020 00:42:05 +0000 (13:42 +1300)]
Bug 19532: (follow-up) aria-hidden attr on OPAC, and more

- removing authnotrequired flag from scripts
- fixing opac buttons
- chmod +x for recalls test files

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Recalls on intranet
Aleisha Amohia [Mon, 11 May 2020 23:52:09 +0000 (23:52 +0000)]
Bug 19532: Recalls on intranet

See recalls on Intranet
- old recalls (all inactive recalls)
- recalls queue (all active recalls) - cancel, expire, revert waiting status, multiple cancel, mark overdue
- recalls to pull (available but not yet waiting) - cancel
- recalls awaiting pickup (awaiting pickup, awaiting pickup more than RecallMaxPickUpDelay days) - expire, revert waiting status
- overdue recalls (overdue to be returned) - cancel, multiple cancel
- biblio recalls tab (all active recalls relevant to this bib) - cancel, expire, revert waiting status, mark overdue
- patron recalls tab (all active recalls relevant to this patron) - cancel, expire, revert waiting status, mark overdue
- patron recalls history tab (all recalls relevant to this patron) - cancel, expire, revert waiting status, mark overdue
- log viewer

and the general circulation of recalls

== TEST PLAN FOR RECALLS ==

ADMINISTRATION

1. Apply all patches
2. Run database updates, update schema files and confirm everything applies cleanly
3. Run tests and confirm everything passes:
t/db_dependent/Koha/Recall.t
t/db_dependent/Koha/Recalls.t
t/db_dependent/Stats.t
t/db_dependent/Circulation/CalcFine.t
t/db_dependent/Koha/Item.t
t/db_dependent/Koha/Biblio.t
t/db_dependent/Koha/Patron.t
t/db_dependent/XSLT.t
t/db_dependent/Search.t
t/db_dependent/Holds.t
t/db_dependent/Circulation/transferbook.t
t/db_dependent/Circulation.t

4. Go to Administration -> system preferences. Find the UseRecalls system preference. It should be DISABLED. Confirm RecallsMaxPickUpDelay is set to 7 by default.
5. Go to Administration -> circulation rules. Confirm there are no recalls circulation rules showing.
6. Test a few circulation flows: checking out, placing a reserve, checking in, fulfilling a reserve, etc. Confirm everything works as normal.

7. Go to Administration -> system preferences. Enable the UseRecalls system preference.
8. Go to Administration -> circulation rules. Set the following rules:
Recalls allowed (count) = 0
Recalls per record (count) = 0
On shelf recalls allowed ( If any unavailable / If all unavailable ) = If any unavailable
Recall due date interval (days) = 3
Recall overdue fine amount = (something different to your normal fine amount)
Recall pickup period (days) = 1

Throughout your testing, try with different combinations of these rules and itemtype / branchcode / categorycode. Also try with null values. Keep the circulation rules open in another tab so you can refer to and update these easily. You should also have at least one other tab open for the staff client, and a third tab open for the OPAC, for ease of testing.

9. Go to your account -> More -> Set permissions. Confirm the recalls permission is checked.
10. Set up a test user with OPAC login details (Borrower A). This could also be your own user, as long as you have OPAC login access.
11. Set up a test record (Biblio A) with at least two items (Item A and Item B) of the same item type (or an item type with the same recall circ rules).

PLACING A RECALL

12. Log in to the OPAC as Borrower A. Do a catalogue search with a term that will return multiple results, including Biblio A.
13. Click on Biblio A.
14. Notice there is a 'Place recall' button on the sidebar menu. Click this button. There will be a message saying that there are no items to recall - this is because all items are available.

15. Check out Item A to another borrower (Borrower B).
16. Refresh the 'Place recall' page. You will still NOT be able to place a recall - this is because Recalls allowed = 0 and Recalls per record = 0.

17. Edit the circulation rules to have the following values:
Recalls allowed (count) = 1
Recalls per record (count) = 1
18. Refresh the 'Place recall' page. You will now see the form to place a recall.

BIBLIO-LEVEL RECALL, NO TRANSFER

19. Place a biblio-level recall.
Pickup location: Branch A, the set branch when you are logged into the staff client
Recall not needed after (expiration date): whatever you want
Select 'recall next available item'
Click confirm
20. Confirm the recall is placed successfully. Confirm that the new due date displayed is correctly calculated to be today's date, plus 3 days (taken from the 'recall due date interval' circ rule)
21. In the staff client, look at Borrower B's account, and go to their Notices tab. Confirm they have received a 'Notification to return recalled item' notice.
22. Look at Borrower B's checkouts table. Notice the due date for their checkout has been adjusted, and there is now a note to say that the item was recalled and the due date adjusted.
23. Log in to the OPAC as Borrower B and go to your summary tab. Notice there is a note under their checkout to say the item had been recalled.

24. Log out of the OPAC and log back in as Borrower A.
25. Go to your summary tab. Confirm there is a Recalls tab with a count of 1.
26. Cancel the recall using the button. Confirm it cancels and the Recalls tab disappears.

27. Do a catalogue search with a term that will return multiple results, including Biblio A.
28. When the results load, notice there is a 'Place recall' button next to the 'Place hold' button. Click this 'Place recall' button.
29. Notice you are redirected straight to the form to place a recall.
30. Place a biblio-level recall again, following the steps in Step 19.

31. Go to your recalls history tab. Notice your first cancelled recall shows here.
32. Cancel the recall you just created, using the button. Confirm it cancels and you are redirected to your summary tab.

33. In the staff client, enable the UseCourseReserves system preference.
34. Go to the main menu, click Course Reserves.
35. Add a new course. (You may also have to define an authorised value for DEPARTMENT.)
36. Add Item A as a reserve to this course.

37. View Course Reserves in the OPAC. Click the course you just created.
38. Notice the reserve has a Recall button underneath it's 'Checked out' status. Click this button.
39. Place a biblio-level recall again, following the steps in Step 19.

40. Click the 'Place recall' link in the breadcrumbs.
41. Notice there is a message saying that you have reached the max number of recalls on this record. This is because Recalls allowed = 1 and Recalls per record = 1.
42. Edit the circulation rules to have the following values:
Recalls allowed (count) = 10
Recalls per record (count) = 5
43. Refresh the 'Place recall' page. You will now see the form to place a recall.

44. Create another test record (Biblio B) with at least one item (Item C).
45. Find this record on the OPAC and place a biblio-level recall again, following the steps in Step 19.

46. In the staff client, go to Circulation -> Old recalls. You should be able to see your two cancelled recalls.
47. Go to Circulation -> Recalls queue. Your current recalls should show here.
48. Use the 'Select all' checkbox to select all recalls.
49. Cancel the recalls using the 'Cancel selected recalls' button.

50. Go to the OPAC and place a biblio-level recall on Biblio A again, following the steps in Step 19.

51. In the staff client, check in Item A, which should still be checked out to Borrower B.
52. A box should pop-up asking you to confirm Borrower A's recall. Click ignore.
53. Click the link to go view Biblio A's details in the catalogue.
54. Click the recalls tab. Notice Borrower A's recall is displayed, and shows it is still Requested (has not been confirmed waiting).

55. Check in Item A again. This time, confirm the recall as waiting using the "Confirm recall" button.
56. Go to Borrower A's Notices tab. Confirm there is a notice "Recalled item awaiting pickup".
57. Go to Borrower A's checkouts. Notice there is a recalls tab. Confirm the recall is showing as "Ready for pickup".
58. Click the 'Actions' dropdown. Click the "Revert waiting" button. The page should show a message that the waiting status has been reverted, without reloading.

59. This time, check in Item B. The recall confirmation box should show again, because this a biblio-level recall that any recallable item under Biblio A can fill. Click the "Print slip and confirm" button.
60. Check the slip that is generated. Confirm it contains Borrower A's correct details, and the details of the recall are correct.
61. Go to Circulation -> Recalls awaiting pickup. Confirm the recall is now waiting and shows in this list.
(You could also try this with Item B having a different item type to Item A, and circ rules not allowing Item B's item type to have recalls. When checking in Item A, it should not trigger the recall box).

62. Go to Borrower A's checkouts. Check out Item B.
63. Confirm the checkout is successful and the recall is removed from the Recalls tab.
64. Go to Circulation -> Old recalls. The fulfilled recall should show.

65. Check in Item B.

BIBLIO-LEVEL RECALL, TRANSFER REQUIRED

66. Check out Item A to Borrower B.
67. Log in to the OPAC as Borrower A.
68. Find Biblio A and place a biblio-level recall.
Pickup location: Branch B, a different branch from your logged in branch. This recall will require a transfer.
Recall not needed after (expiration date): whatever you want
Select 'recall next available item'
Click confirm

69. In the staff client, check in Item A at Branch A. Notice the box that pops up shows that a transfer is required.
70. Click "confirm recall and transfer" and confirm the transfer.
71. Go to your account and click the Recalls tab.
72. Confirm the recall status now shows the item is in transit to Branch B.
73. In the drop-down top-right of your window, select 'Set library'.
74. Set your library to Branch B.

75. Go to Circulation -> Transfers to receive. Notice that the recall is showing here.
76. Click 'Cancel transfer'.
77. Go to Circulation -> Recalls queue
78. Confirm the recall status has been reverted to Requested.

79. Set your library back to Branch A.
80. Check in Item A and trigger the transfer.
81. Set your library back to Branch B.

82. Check in Item A at Branch B.
83. When the 'Recall found' box pops up, click Ignore.
84. Go to Circulation -> Recalls to pull. The recall should show here, with a button to "Cancel recall and return to: Branch A"
85. Click the button to cancel the recall.

86. Repeat Steps 66-70.
87. Check in Item A at Branch B. Confirm the recall as waiting.
88. Check out Item A to Borrower A to fulfill the recall.

89. Set your library back to Branch A and check in Item A.

ITEM-LEVEL RECALL, NO TRANSFER

90. Go to Administration -> circulation rules. Set the following rules:
On shelf recalls allowed ( If any unavailable / If all unavailable ) = If all unavailable

91. Check out Item A to Borrower B.
92. Log in to the OPAC as Borrower A and go to Biblio A.
93. Click the 'Place recall' button. Confirm there is a message that there are no items to recall. This is because On shelf recalls allowed = If all unavailable, and there is still one item (Item B) available.
94. In the staff client, edit Item B to have a withdrawn, item lost or not for loan status.
95. Refresh the 'Place recall' page. Confirm you can now see the form to place a recall.

96. Place an item-level recall.
Pickup location: Branch A.
Recall not needed after (expiration date): whatever you want
Select 'recall a specific item'
Item B will not be selectable, and Item A should be selected by default.
Click confirm

97. In the staff client, edit Item B and remove the lost or missing status.
98. Check in Item B. Confirm the recall box does not pop up, because it cannot fill the item-level recall.
99. Check in Item A. Confirm the recall as waiting.
100. Go to Circulation -> Recalls awaiting pickup
101. Expire the recall. Confirm it expires as expected.

ITEM-LEVEL RECALL, TRANSFER REQUIRED

102. Repeat steps 91 to 95.
103. Place an item-level recall.
Pickup location: Branch B, we will require a transfer.
Recall not needed after (expiration date): whatever you want
Select 'recall a specific item'
Item B will not be selectable, and Item A should be selected by default.
Click confirm
104. In the staff client, check in Item A. Confirm the recall and trigger the transfer.
105. Set your library to Branch B and check in Item A.
106. Confirm the recall as waiting.
107. Check out Item A to Borrower A and fulfill the recall.

108. Set your library back to Branch A and check in Item A.

CRONJOBS: EXPIRING RECALL

109. Check out Item A to Borrower B.
110. Log in to the OPAC as Borrower A. Place a recall (any level) on Biblio A.
111. In your terminal, enter mysql and edit the expiration date of your recall to be before today
UPDATE recalls SET expirationdate = NOW()-2 WHERE recall_id = X;
112. Run the expiry cronjob from within your shell
perl misc/cronjobs/recalls/expire_recalls.pl
113. Go to Borrower A's account and go to the Recalls history tab
114. Confirm the recall has been expired because the current date surpassed the specified expiration date

115. Check out Item A to Borrower B.
116. Log in to the OPAC as Borrower A. Place a recall (any level) on Biblio A.
117. In the staff client, check in Item A and confirm the recall as waiting.
118. In your terminal, enter mysql and edit the waiting date of your recall to be before today
UPDATE recalls SET waitingdate = NOW() - interval 5 day WHERE recall_id = X;
119. Run the expiry cronjob from within your shell
perl misc/cronjobs/recalls/expire_recalls.pl
120. Go to Borrower A's account and go to the Recalls history tab
121. Confirm the recall has been expired because the recall had been waiting for more days than the Recall pickup period

122. Go to Administration -> circulation rules. Set the following rules:
Recall pickup period (days) = 0
123. Set the RecallsMaxPickUpDelay system preference = 1.
124. Check out Item A to Borrower B.
125. Log in to the OPAC as Borrower A. Place a recall (any level) on Biblio A.
126. In the staff client, check in Item A and confirm the recall as waiting.
127. In your terminal, enter mysql and edit the waiting date of your recall to be before today
UPDATE recalls SET waitingdate = NOW()-2 WHERE recall_id = X;
128. Run the expiry cronjob from within your shell
perl misc/cronjobs/recalls/expire_recalls.pl
129. Go to Borrower A's account and go to the Recalls history tab
130. Confirm the recall has been expired because the recall had been waiting for more days than the RecallsMaxPickUpDelay syspref

CRONJOBS: OVERDUE RECALL

131. Check out Item A to Borrower B
132. Log in to the OPAC as Borrower A. Place a recall (any level) on Biblio A.
133. In your terminal, enter mysql and edit the due date of the checkout to Borrower B to be before today
UPDATE issues SET date_due = NOW()-2 WHERE issue_id = X;
134. Run the overdue cronjob from within your shell
perl misc/cronjobs/recall/overdue_recalls.pl
135. Go to Circulation -> Overdue recalls
136. Confirm your recall is showing here now as the recall has been marked Overdue

CIRCULATION

137. Check in Item A.
138. When the recall box pops up, click Ignore.
139. Check out Item A to Borrower B. You should see a yellow confirmation box, saying that another borrower has recalled the item you are trying to check out.
140. Click "No don't check out" and confirm the item isn't checked out and the recall remains.
141. Repeat Step 139.
142. Click "Yes check out" and confirm the item is checked out and the recall remains.
143. When Borrower B's checkout table loads, confirm that you cannot renew or check in the item from the Checkouts table because there is a 'Recalled' link which takes you to the recalls tab for that biblio.
144. Repeat Steps 137-139.
145. Select "Cancel recall" and click "Yes check out" and confirm the item is checked out and the recall has been cancelled.
146. Log in to the OPAC as Borrower A. Place a recall (any level) on Biblio A.
147. Check in Item A. Confirm the recall as waiting.
148. Check out Item A to Borrower B. You should see a yellow confirmation box, saying that that another borrower has recalled the item that you are trying to check out.
149. Select "Revert waiting status" and click "Yes check out" and confirm the item is checked out and the recall status has reverted to requested.

OTHER
150. In your terminal, enter mysql and edit the due date of the checkout to Borrower B to be before today
UPDATE issues SET date_due = NOW()-2 WHERE issue_id = X;
151. Go to Borrower A's recalls and click the Actions dropdown.
152. Click "Mark as overdue" and confirm the recall is marked as overdue manually.

153. Go to Tools -> Log Viewer. Check only the Recalls module, and leave all other parameters, and click Submit.
154. Confirm all of the recalls actions that have been made are correctly logged.

Note: recalls messaging preferences are introduced in Bug 23781.
The recall feature is fully documented at: https://wiki.koha-community.org/wiki/Catalyst_IT_Recalls

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Recalls on OPAC
Aleisha Amohia [Mon, 11 May 2020 23:52:52 +0000 (23:52 +0000)]
Bug 19532: Recalls on OPAC

- place a biblio-level or item-level recall via the biblio detail page, OPAC search results, or course reserves
- view or cancel your active recalls from 'your summary' recalls tab
- view all active and inactive (and cancel active) recalls from 'your recall history'
- stopped from placing a reserve on an item that the patron has already recalled

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Other objects used in recalls feature
Aleisha Amohia [Wed, 22 Apr 2020 20:06:54 +0000 (20:06 +0000)]
Bug 19532: Other objects used in recalls feature

- biblio->recalls
- biblio->can_be_recalled
- item->recall
- item->can_be_recalled
- item->can_set_waiting_recall
- item->check_recalls
- patron->recalls
- Biblio.RecallsCount

and relevant tests
- t/db_dependent/Stats.t
- t/db_dependent/Koha/Item.t
- t/db_dependent/Koha/Biblio.t
- t/db_dependent/Koha/Patron.t
- t/db_dependent/XSLT.t
- t/db_dependent/Search.t
- t/db_dependent/Holds.t
- t/db_dependent/Circulation/transferbook.t
- t/db_dependent/Circulation.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Expiry and overdue cronjobs, and overdue fine calculation
Aleisha Amohia [Wed, 22 Apr 2020 16:47:17 +0000 (16:47 +0000)]
Bug 19532: Expiry and overdue cronjobs, and overdue fine calculation

- misc/cronjobs/recalls/expire_recalls.pl
- misc/cronjobs/recalls/overdue_recalls.pl
- tests for overdue fines in t/db_dependent/Circulation/CalcFine.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Recalls objects and tests
Aleisha Amohia [Wed, 22 Apr 2020 07:35:47 +0000 (07:35 +0000)]
Bug 19532: Recalls objects and tests

Koha/Recall.pm
- biblio
- item
- patron
- library
- checkout
- requested
- waiting
- overdue
- in_transit
- expired
- cancelled
- finished
- calc_expirationdate
- start_transfer
- revert_transfer
- set_waiting
- revert_waiting
- set_overdue
- set_expired
- set_cancelled
- set_finished
- should_be_overdue

Koha/Recalls.pm
- add_recall
- move_recall

and relevant tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: [DBIx] Schema change for Recalls
Marcel de Rooy [Wed, 2 Mar 2022 13:23:35 +0000 (13:23 +0000)]
Bug 19532: [DBIx] Schema change for Recalls

Separated from the "Recalls-objects-and-tests" patch

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: [DBIx] Add boolean flags to recalls.old and recalls.item_level_recall
Aleisha Amohia [Fri, 23 Oct 2020 23:12:22 +0000 (12:12 +1300)]
Bug 19532: [DBIx] Add boolean flags to recalls.old and recalls.item_level_recall

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: [DBIx] Updated schema files
Aleisha Amohia [Thu, 14 Oct 2021 02:07:50 +0000 (15:07 +1300)]
Bug 19532: [DBIx] Updated schema files

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: Database and installer stuff
Aleisha Amohia [Wed, 22 Apr 2020 00:47:13 +0000 (00:47 +0000)]
Bug 19532: Database and installer stuff

- Add recalls table
- Add recalls circulation rules - recalls allowed, recalls per record, on shelf recalls, recall due date interval, recall overdue fine, recall shelf time
- Add system preferences - useRecalls, RecallsMaxPickUpDelay, RecallsLog
- Add email notices (RETURN_RECALLED_ITEM, PICKUP_RECALLED_ITEM)
- Add print notice (RECALL_REQUESTER_DET)
- Add user permission - recalls, manage_recalls
- Add Recall and CancelRecall enum options for branchtransfers reason

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30209: Upgrade 'libdbd-sqlite2-perl' package to 'libdbd-sqlite3-perl'
Mason James [Wed, 2 Mar 2022 01:46:09 +0000 (14:46 +1300)]
Bug 30209: Upgrade 'libdbd-sqlite2-perl' package to 'libdbd-sqlite3-perl'

to test...

1/ apply patch, build and install new package

2/ check that libdbd-sqlite3-perl package is installed

     $ dpkg -l | grep libdbd-sqlite
     ii  libdbd-sqlite3-perl:amd64              1.62-3          amd64

    note: libdbd-sqlite3-perl package installs DBD::SQLite module, which uses sqlite3 :)

        https://packages.debian.org/stretch/libdbd-sqlite3-perl
        https://metacpan.org/pod/DBD::SQLite

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 15594: (QA follow-up) Move span to publisher name, fix whitespace, only add space...
Nick Clemens [Fri, 4 Mar 2022 16:48:19 +0000 (16:48 +0000)]
Bug 15594: (QA follow-up) Move span to publisher name, fix whitespace, only add spaces once per loop

This patch updates the whitespace for readbility
Moves the Ogranization span to the subfield b, publisher name only
Moves check for last/whitespace to the loop

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: Class in now unchanged after the patch
The Minh Luong [Thu, 3 Mar 2022 20:03:57 +0000 (15:03 -0500)]
Bug 15594: Class in now unchanged after the patch

I'm not sure if this is the actual issue, but I found that the patch puts the span with
the class "publisher_name" inside a new span with typeOf="Organization".

In this patch, I removed that new span, to keep it coherent with the previous code.
Also, the MARC 260 subfields are displayed correctly !

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: preserve sequence of 260 subfields in (staff) detail page
Blou [Wed, 8 Dec 2021 21:45:29 +0000 (16:45 -0500)]
Bug 15594: preserve sequence of 260 subfields in (staff) detail page

When ordered $a$b$a$b$c in the MARC object, 260 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

0) create a notice with $a$b$a subfields.  In that (mixed) order.
1) Go to staff detail page and see the fields displayed as "aab"
2) apply the patch
3) validate the aba display.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: preserve sequence of 260 subfields in detail page
Blou [Mon, 6 Dec 2021 18:48:30 +0000 (13:48 -0500)]
Bug 15594: preserve sequence of 260 subfields in detail page

When ordered $a$b$a$b$c in the MARC object, 260 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

0) create a notice with $a$b$a subfields.  In that (mixed) order.
1) Go to detail page and see the fields displayed as "aab"
2) apply the patch
3) validate the aba display.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30190: Compiled CSS
Fridolin Somers [Wed, 9 Mar 2022 08:19:01 +0000 (22:19 -1000)]
Bug 30190: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30190: Green buttons turn blue for a second when clicking them
Owen Leonard [Wed, 2 Mar 2022 14:23:36 +0000 (14:23 +0000)]
Bug 30190: Green buttons turn blue for a second when clicking them

This patch adds additional CSS to better cover various states of buttons
in the OPAC.

To test, apply the patch and rebuild the OPAC CSS:
https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client

- In the OPAC, test various green buttons in varous states: default,
  hover, and active (the appearance when the button is clicked but
  before the mouse button is released).
- The button should be styled in various shades of green in all cases.
- Test a disabled button by performing a catalog search.
- On the results page, before any checkboxes are checked, the "Save"
  button should look correct.

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>
2 years agoBug 29136: (QA follow-up) missing filters
Nick Clemens [Fri, 18 Feb 2022 16:36:56 +0000 (16:36 +0000)]
Bug 29136: (QA follow-up) missing filters

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29136: Don't redirect if the whole set is > 1
Jonathan Druart [Mon, 7 Feb 2022 16:27:37 +0000 (17:27 +0100)]
Bug 29136: Don't redirect if the whole set is > 1

To prevent a redirect when we click on a page with only 1 result

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29136: Ajaxify the patron search when placing a hold
Jonathan Druart [Tue, 1 Feb 2022 10:06:49 +0000 (11:06 +0100)]
Bug 29136: Ajaxify the patron search when placing a hold

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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>
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>
2 years agoBug 30128: DBrev 21.12.00.017
Fridolin Somers [Wed, 9 Mar 2022 08:00:05 +0000 (22:00 -1000)]
Bug 30128: DBrev 21.12.00.017

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30128: DBIC Schema update
Fridolin Somers [Wed, 9 Mar 2022 07:58:02 +0000 (21:58 -1000)]
Bug 30128: DBIC Schema update

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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>
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: Fridolin Somers <fridolin.somers@biblibre.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>
2 years agoBug 28782: (QA follow-up) Fix missing filter
Nick Clemens [Fri, 18 Feb 2022 16:19:23 +0000 (16:19 +0000)]
Bug 28782: (QA follow-up) Fix missing filter

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: (QA follow-up) Bug 29844 follow-up
Nick Clemens [Fri, 18 Feb 2022 16:15:55 +0000 (16:15 +0000)]
Bug 28782: (QA follow-up) Bug 29844 follow-up

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Fix cancel holds in bulk
Jonathan Druart [Fri, 28 Jan 2022 13:47:12 +0000 (14:47 +0100)]
Bug 28782: Fix cancel holds in bulk

See also bug 29969.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Fix link when placing a hold for a patron from patron list
Jonathan Druart [Fri, 28 Jan 2022 13:46:38 +0000 (14:46 +0100)]
Bug 28782: Fix link when placing a hold for a patron from patron list

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: (follow-up) Pass real array to query_form()
Joonas Kylmälä [Sat, 30 Oct 2021 21:49:10 +0000 (21:49 +0000)]
Bug 28782: (follow-up) Pass real array to query_form()

It excepts to receive a real array and not a list, in order to be able
to generate the query parameters.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Use query param list instead of splitting elements using '/'
Joonas Kylmälä [Thu, 29 Jul 2021 14:23:01 +0000 (17:23 +0300)]
Bug 28782: Use query param list instead of splitting elements using '/'

This removes the need to handle single and multiple cases separately,
thus removing bunch if-else cases and simplifying our code. This
coding style is also in line with our other .pl scripts.

To test:
 1) Make sure placing a hold still works from the following pages:

   /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX

   /cgi-bin/koha/catalogue/search.pl?q=a

   /cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=XXXX

   /cgi-bin/koha/clubs/clubs.pl (create a new club and add a patron
   there and through the clubs.pl create a hold to a bib)

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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>
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>
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>
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>
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>
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>
2 years agoBug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with...
Janusz Kaczmarek [Thu, 24 Feb 2022 20:26:46 +0000 (21:26 +0100)]
Bug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with IndependentBranches on

Problem arises after applying bugfix 27526 and 28445: with
IndependentBranches on, a librarian without superlibrarian privileges,
can edit (and potentially delete) every item (i.e. also from a foreign
branch).  This is because can_be_edited calculation is buggy (in two spots).

Test plan:
1. Have (at least) two branches defined.
2. Have IndependentBranches set.
3. Have a biblio record with items belonging to different branches.
4. Be a librarian without superlibrarian rights, with editcatalogue
   and tool permissions set.

Scenario A (Edit items):
1. Go to Edit -> Edit items view (cataloguing/additems.pl).
2. You will be able to edit every item, also ones not from the branch
   you are from (cf. the button 'Actions').
3. Apply the patch.
4. Repeat 1.
5. You should be able to edit only the items from your branch.

Scenario B (Edit items in batch):
1. From Normal view go to Edit -> Edit items in batch.
2. You will be able to batch edit every item, also ones not from the branch
   you are from.
3. Apply the patch.
4. Repeat 1.
5. You should be able to edit only the items from your branch (and
   see 'Cannot edit' for others.

Scenario C (Delete items in batch):
1. From Normal view go to Edit -> Delete items in batch.
2. You will not see the string 'Cannot delete' and only by chance
   will not be able to activate the checkboxes next to foreign items.
3. Apply the patch.
4. Repeat 1.
5. You should be able to delete only the items from your branch (and
   see 'Cannot delete' for others.

Scenario D and E:
Analogous steps can be executed from Tools -> Batch item modification
and Tools -> Batch item deletion

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 30072: (follow-up) Fix UT after Bug 29857
Fridolin Somers [Fri, 4 Mar 2022 00:42:04 +0000 (14:42 -1000)]
Bug 30072: (follow-up) Fix UT after Bug 29857

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30125: (QA follow-up) Rename variable as cities
Nick Clemens [Fri, 18 Feb 2022 12:03:46 +0000 (12:03 +0000)]
Bug 30125: (QA follow-up) Rename variable as cities

It's what we are testing :-)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30125: Add full-stack tests for API pagination
Tomas Cohen Arazi [Thu, 17 Feb 2022 17:50:14 +0000 (14:50 -0300)]
Bug 30125: Add full-stack tests for API pagination

This patch adds tests for all the pagination use cases on a real route
(GET /cities). It tests _page, _per_page along with the returned Link
headers and total counts (i.e. X-Total-Count, X-Base-Total-Count), and
the results themselves.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/pagination.t
=> SUCCESS: Tests pass!
3. 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>
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>
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>
2 years agoBug 30007: (follow-up) Adapt tests
Tomas Cohen Arazi [Wed, 2 Mar 2022 18:05:02 +0000 (15:05 -0300)]
Bug 30007: (follow-up) Adapt tests

This patch adapts tests to acknowledge ->cancel and ->fill methods won't
yield 'undef' borrowernumber when anonymization takes place, and even
further, and exception will be thrown and cancellation/fulfillment will
be rejected.

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

Bonus: this problem was hidding bad tests caused by 29857, fixed on this
one as well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25616: (follow-up) Fix t/Search.t
Fridolin Somers [Wed, 2 Mar 2022 18:52:54 +0000 (08:52 -1000)]
Bug 25616: (follow-up) Fix t/Search.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>