]> git.koha-community.org Git - koha.git/log
koha.git
2 years agoBug 30290: Adjust sample_notices.yml
Marcel de Rooy [Mon, 14 Mar 2022 11:37:11 +0000 (11:37 +0000)]
Bug 30290: Adjust sample_notices.yml

Test plan:
Run a new install. Check the AR notices.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30722: Typo in overdue recalls template
Owen Leonard [Mon, 9 May 2022 15:42:44 +0000 (15:42 +0000)]
Bug 30722: Typo in overdue recalls template

This patch corrects a typo in the <title> tag of the
overdue recalls template:

"Circulaion" corrected to "Circulation."

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30706: Fix space in check for dateformat preference
Owen Leonard [Fri, 6 May 2022 13:31:31 +0000 (13:31 +0000)]
Bug 30706: Fix space in check for dateformat preference

This patch fixes the calendar.inc includes in both staff and OPAC in
order to remove a typo: An extra space in the check for the "dateformat"
system preference.

The result of this error is that changes to the dateformat system
preference will not be correctly applied to Koha without a restart.

To reproduce the problem start the process of creating a new patron.

 - In the date of birth field, select a date. The format of the date
   inserted should match your current dateformat system preference.
 - Go to Administration -> System preferences and update dateformat to
   something different.
 - Go back to the patron creation form (refresh it if necessary).
 - The hint under the Date of birth field will match your updated system
   preference, but when you pick a date using the calendar widget it
   will still be formatted according to the old value of dateformat.

To test the fix, apply the patch and run through the same steps above.
A change the dateformat preference should be immediately reflected in
the functionality of the calendar widget.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30668: Do not record itme location updates in cataloguing log
Nick Clemens [Fri, 6 May 2022 20:10:54 +0000 (20:10 +0000)]
Bug 30668: Do not record itme location updates in cataloguing log

To test:
1 - Set a rule in UpdateItemLocationOnCheckin
2 - Enable cataloguing log
3 - Check in an item that will trigger a change
4 - Check the modification log for item - there is a cataloguing entry
5 - Apply patch
6 - Repeat
7 - No log!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30668: Unit tests
Nick Clemens [Fri, 6 May 2022 20:09:27 +0000 (20:09 +0000)]
Bug 30668: Unit tests

Simple test to cover UpdateNOtForLoanStatusOnCheckin and UpdateItemLocationOnCheckin
to confirm the cataloguing log does not record these

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29755: (follow-up) Mock NoIssuesChargeGuarantorsWithGuarantees in test
Nick Clemens [Thu, 28 Apr 2022 11:07:17 +0000 (11:07 +0000)]
Bug 29755: (follow-up) Mock NoIssuesChargeGuarantorsWithGuarantees in test

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 29755: Check each NoIssuesCharge separately
Nick Clemens [Thu, 10 Feb 2022 14:30:02 +0000 (14:30 +0000)]
Bug 29755: Check each NoIssuesCharge separately

This patch updates SIP patron code to use account methods to calculate balances
over the patronflags returns. It also checks if patron should be blocked for each
'No Issues charge' preference

Tests are added for NoIssuesChargeGuarantees

To test:
 1 - Set noissuescharge preference to 5
 2 - Add a $10 charge to a patron
 3 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron BARCODE
 4 - Note the 64 message starts with Y's that mean patron is blocked
 5 - Set noissuescharge to 11
 6 - Repeat 3, patron is no longer blocked
 7 - Set NoIssuesChargeGuarantees to 8
 8 - Repeat 3, patron is blocked
 9 - Pay $3 on patron so they owe 7
10 - Repeat 3, patron is not blocked
11 - Add a child account with patron as guarantor
12 - Repeat 3, patron is not blocked
13 - Add a $4 charge to child
14 - Repeat 3, patron is blocked
15 - Repeat 3, but with child barcode, child is not blocked
16 - Set NoIssuesChargeGuarantorsWithGuarantees to 10
17 - Repeat 3, patron is blocked
18 - Repeat 3 with child barcode, child is blocked

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 30604: Add value builders for UNIMARC 146 ($a, $h and $i)
Julian Maurice [Tue, 18 Jan 2022 13:36:34 +0000 (14:36 +0100)]
Bug 30604: Add value builders for UNIMARC 146 ($a, $h and $i)

Test plan:
1. Configure the default MARC framework to use those value builders:
   - unimarc_field_146a for 146$a
   - unimarc_field_146h for 146$h
   - unimarc_field_146i for 146$i
2. Verify that they all work correctly according to
https://www.ifla.org/files/assets/uca/unimarc_updates/BIBLIOGRAPHIC/u-b_146.pdf

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 30703: Remove a few CookieManager warnings
Marcel de Rooy [Fri, 6 May 2022 07:24:07 +0000 (07:24 +0000)]
Bug 30703: Remove a few CookieManager warnings

Running Auth.t produces several warnings like:
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 103.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 104.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 112.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 103.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 104.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 112.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 103.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 104.
Use of uninitialized value $name in hash element at /usr/share/koha/Koha/CookieManager.pm line 112.

Test plan:
prove  t/CookieManager.t t/db_dependent/Auth.t

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 30702: Fix Context.pm L785 warning on sessionID
Marcel de Rooy [Fri, 6 May 2022 07:09:34 +0000 (07:09 +0000)]
Bug 30702: Fix Context.pm L785 warning on sessionID

Trivial fix. Before working on bug 29954.

Test plan:
Run a few tests like t/Context.t, t/db_dependent/Auth.t and
t/db_dependent/Circulation.t.

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 30638: Resolve odd number in hash warn in Letters
Marcel de Rooy [Thu, 28 Apr 2022 10:04:02 +0000 (10:04 +0000)]
Bug 30638: Resolve odd number in hash warn in Letters

Odd number of elements in anonymous hash at C4/Letters.pm line 827.

Trivial fix. Adding undefined check on result to prevent warns
on that one.

No test plan. Read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30551: Make cash register report take branchcode from cash register
Shi Yao Wang [Fri, 15 Apr 2022 16:37:34 +0000 (12:37 -0400)]
Bug 30551: Make cash register report take branchcode from cash register

This patch makes it so cash register reports puts branchcode from the
cash register where the payment was made into "Transaction library"
column instead of taking the branchcode of the manager.

Test plan:
1- Use cash registers (administration > system preferences > UseCashRegisters)
2- Create another library if you only have one (administration > libraries > new library)
3- Create a cash register in each library if they don't already have one (administration > cash registers > new cash register)
4- Create a fee on your own account and pay it right after in both libraries.
5- Go to reports > cash register and generate the statistics.
6- Notice "transaction library" in both rows are the same even though the fees were paid in two different libraries and two different cash registers.
7- Apply the patch and click submit to re-generate statistics
8- Notice it now shows the correct library where the transactions were done

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29705: In test suite merge IssuingRules with CirculationRules
Fridolin Somers [Wed, 15 Dec 2021 21:19:21 +0000 (11:19 -1000)]
Bug 29705: In test suite merge IssuingRules with CirculationRules

After Bug 18936, in test suite, there is still t/db_dependent/Koha/IssuingRules.t and t/db_dependent/Koha/IssuingRules/
This patch moves IssuingRules.t inside CirculationRules.t and renames dir t/db_dependent/Koha/IssuingRules.
And adds DB transation in each first-level subtest.

Also renames in :
  use constant GUESSED_ITEMTYPES_KEY => 'Koha_IssuingRules_last_guess';

Test plan :
Run prove t/db_dependent/Koha/CirculationRules.t
prove t/db_dependent/Koha/CirculationRules/*
prove t/db_dependent/Circulation/maxsuspensiondays.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30688: Compiled CSS
Fridolin Somers [Fri, 6 May 2022 20:22:24 +0000 (10:22 -1000)]
Bug 30688: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30688: Error in path to CSS background image
Owen Leonard [Thu, 5 May 2022 10:47:04 +0000 (10:47 +0000)]
Bug 30688: Error in path to CSS background image

This patch corrects the path of an image specified as the background to
a couple of elements in the OPAC. The incorrect path was causing 404
errors.

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).

- If necessary, activate one or more cover image services in
  Administration, e.g. OPACAmazonCoverImages, OPACLocalCoverImages,
  and/or OpenLibraryCovers.
- In the OPAC, locate a bibliographic record which has a cover image
  from one or more of the services you activated.
- On the detail page for that record, the cover should load correctly.
- In the browser console you should see no errors related to a file not
  found: /opac-tmpl/bootstrap/img/spinner-small.gif
- In the browser console, submit this JavaScript snippet:

  $(".cover-image").remove();

  The cover image should disappear, revealing the "spinner" icon behind
  it.

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 30613: Hide RSS feed link when viewing private list in the OPAC
Owen Leonard [Thu, 5 May 2022 14:02:26 +0000 (14:02 +0000)]
Bug 30613: Hide RSS feed link when viewing private list in the OPAC

This patch wraps the List RSS icon in a check on whether the list is
public. Private lists RSS can only be accessed by a logged-in patron.

To test apply the patch and view a public list in the OPAC. You should
see an RSS link icon next to the list title.

Now log in to the OPAC and view a private list. There should be no RSS
link.

Note the QA tool warning about the aria-hidden attribute is a false
positive. The parent element has a label.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30639: Split search terms for patron search
Jonathan Druart [Thu, 28 Apr 2022 12:42:04 +0000 (14:42 +0200)]
Bug 30639: Split search terms for patron search

If several terms are passed we should split them.

Test plan:
Search for "edna acosta" (without quotes) in the filters from the left
side of the main patron search
Do some regression tests

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 30607: Don't overload our default initComplete
Jonathan Druart [Wed, 27 Apr 2022 11:52:55 +0000 (13:52 +0200)]
Bug 30607: Don't overload our default initComplete

We want to keep the default initComplete call to add/remove the
'disabled' class on the 'Clear filters' link.

Test plan:
Search for patrons, add something to the general DT search and confirm
that the 'Clear filters' link can be clicked (ie. is not disabled) when
the input field is not empty.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Agree that it does not look very elegant.
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30514: Error in date format check following datepicker removal
Owen Leonard [Tue, 12 Apr 2022 14:23:42 +0000 (14:23 +0000)]
Bug 30514: Error in date format check following datepicker removal

This patch corrects the is_valid_date function in the OPAC and staff
interface so that it work correctly with Flatpickr.

To test, apply the patch and clear your browser cache if necessary.

- In the staff client, locate a bibliographic record and edit its items.
- Test that the "Date acquired" date picker works correctly and that
  there are no errors in the browser console.
- Test other date input fields to check that they still work, e.g.
  specify due date during checkout; Catalog statistics wizard; Patron
  entry/modification, etc.
- Perform similar tests in the OPAC: Hold suspension; Update your
  personal details.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30709: 'Insert' button in notices editor not adding selected placeholders to...
Owen Leonard [Fri, 6 May 2022 12:05:12 +0000 (12:05 +0000)]
Bug 30709: 'Insert' button in notices editor not adding selected placeholders to notice

This patch updates letter.js so that it uses .prop("selected") to look
for selected <option>s instead of .attr("selected"). This is necessary
because of the jQuery upgrade.

To test, apply the patch and edit any notice. Test that you can select
one or more database columns and insert them into the body of a notice
by clicking "Insert." Confirm that your selections are inserted where
you left the cursor in the message textarea.

Test with multiple message transports and with multiple languages
installed (with TranslateNotices enabled).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30622: Patron search when placing hold should redirect if cardnumber is entered
Jonathan Druart [Wed, 27 Apr 2022 14:44:53 +0000 (16:44 +0200)]
Bug 30622: Patron search when placing hold should redirect if cardnumber is entered

When search a patron for placing a hold, if a cardnumber is entered we
should pick the patron and use it, instead of display the table result.

This was a regression caused by bug 30063.

Test plan:
- Place a hold on anything in staff
- Search for 42 or any other existing cardnumber in your database

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29926: (QA follow-up) Date format missing in spec
Tomas Cohen Arazi [Tue, 26 Apr 2022 13:09:04 +0000 (10:09 -0300)]
Bug 29926: (QA follow-up) Date format missing in spec

On fixing the spec to have `format: date` I noticed the tests were
expecting explosions because of date handling not being done. The
OpenAPI plugin does this correctly when you set the format right.

So, I adapted the tests so they expect 400 and return the type error.

We don't usually add such tests (i.e. test the plugin does its job
correctly) but it doesn't hurt to keep them just in case something
really changes badly there (plugin bug?).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29926: (QA follow-up) API design fixes
Tomas Cohen Arazi [Tue, 26 Apr 2022 12:52:21 +0000 (09:52 -0300)]
Bug 29926: (QA follow-up) API design fixes

This patch makes the following changes to the spec:

* Password being the resource and expiration_date an attribute for it,
  so reorganizing things and also renaming the route.
* Be it undefined or defined, expiration date is only one and thus
  should use the PUT verb (as in overwrite).
* Minor bug 30194-related fixes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29926: Add ability for superlibrarians to batch edit password expiration dates
Nick Clemens [Mon, 14 Feb 2022 16:34:23 +0000 (16:34 +0000)]
Bug 29926: Add ability for superlibrarians to batch edit password expiration dates

To test:
1 - Sign in as a superlibrarian
2 - Tools->Batch patron modification
3 - Add patrons with and without pasword expiration set
4 - Confirm dates display correctly on modification page, or show never
5 - Check the box to delete all dates
6 - Confirm patrons now show 'Never'
7 - Edit patrons again, set a date
8 - Confirm date is set correctly
9 - Sign in as a user with catalogue/tools/borrowers permissions, but not superlibrarian
10 - Confirm y9ou do not see, and cannnot edit password expiration dates

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29926: Add ability for superlibrarian to view/edit password expiration
Nick Clemens [Mon, 14 Feb 2022 16:01:07 +0000 (16:01 +0000)]
Bug 29926: Add ability for superlibrarian to view/edit password expiration

To  test:
 1 - Sign in as a superlibrarian
 2 - Find a patron account with no password expiration set
 3 - View member detials
 4 - note expiration says 'Never'
 5 - Edit patron
 6 - Set patron expiration
 7- Save
 8 - View details, confirm password expiration shows correctly
 9 - Sign in as non-superlibrarian
10 - Confirm you don't see expirationdate on details page
11 - Edit patron and confirm password expiration does not show
12 - Edit HTML and confirm you epxiration date not saved
     <input type="text" name="password_expiration_date" value="2052-05-02">

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29926: Add pasword expiration route for API
Nick Clemens [Mon, 14 Feb 2022 16:00:23 +0000 (16:00 +0000)]
Bug 29926: Add pasword expiration route for API

To test:
1 - prove -v t/db_dependent/api/v1/patrons_password_expiration.t

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29925: (follow-up) Add new pref in sysprefs.sql
Fridolin Somers [Fri, 6 May 2022 19:50:14 +0000 (09:50 -1000)]
Bug 29925: (follow-up) Add new pref in sysprefs.sql

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29925: DBRev 21.12.00.051
Fridolin Somers [Fri, 6 May 2022 19:49:42 +0000 (09:49 -1000)]
Bug 29925: DBRev 21.12.00.051

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29925: (follow-up) Allow password reset when OpacPublic not set
Nick Clemens [Thu, 10 Feb 2022 12:20:20 +0000 (12:20 +0000)]
Bug 29925: (follow-up) Allow password reset when OpacPublic not set

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29925: Add a password reset page for expired passwords
Nick Clemens [Wed, 26 Jan 2022 12:10:49 +0000 (12:10 +0000)]
Bug 29925: Add a password reset page for expired passwords

This patch adds a new page opac-reset-password where a user cna enter their login
(userid or carndumber), current password, and new password.

If the user has a password expiration date and the current password is correct and
the new passwords match and meet requirements their password will be updated and the
expiration date reset

A patron whose password does not expire will be reidrected to login to change their password

To test:
 1 - Apply patch, updatedatabase, enable new syspref EnableExpiredPasswordReset
 2 - Set 'Password expiration' for a patron category
     Home->Administration->Patron categories->Edit
 3 - Create a new patron in this category with a userid/password set, and an email
 4 - Update the patron with an expiration to be expired
     UPDATE borrowers SET password_expiration='2022-01-01' WHERE borrowernumber=51;
 5 - Give the borrower catalogue permission
 6 - Attempt to log in to Straff interface
 7 - Confirm you are signed out and notified that password must be reset
 8 - Click 'Reset your password' link
 9 - You should see the reset password page with fields for: login, current password, new password, conmfirm password
10 - enter invalid/incomplete credentials
11 - Confirm you are notified of invlaid credentials
12 - Fill in all fields, but enter current password as new password
13 - Confirm you are notified of no change
14 - Set minimum password length / strong password requirement for category
15 - Confirm you receive error if new password too short or not secure
16 - Enter a valid new password and submit and confirm update is successful
17 - Confirm you have buttons to go to OPAC or Staff and that both work
18 - Confirm you cna log in (i.e. expiration has been reset)
19 - Expire the users password
20 - Remove catalogue permission
21 - Reset password again and confirm only OPAC link

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: (follow-up) Fix t/db_dependent/Koha/Patron.t number of tests
Fridolin Somers [Fri, 6 May 2022 19:41:52 +0000 (09:41 -1000)]
Bug 29924: (follow-up) Fix t/db_dependent/Koha/Patron.t number of tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: DBRev 21.12.00.050
Fridolin Somers [Fri, 6 May 2022 19:36:48 +0000 (09:36 -1000)]
Bug 29924: DBRev 21.12.00.050

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: Update DBIC schema
Fridolin Somers [Fri, 6 May 2022 19:34:26 +0000 (09:34 -1000)]
Bug 29924: Update DBIC schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: Avoid leaking information on wrong credentials
Tomas Cohen Arazi [Tue, 26 Apr 2022 18:03:05 +0000 (15:03 -0300)]
Bug 29924: Avoid leaking information on wrong credentials

If the passed credentials are wrong, we shouldn't expose things like the
password is expired.

This patch takes care of that.

To test:
1. Have a known patron with password_expiration_date set so its
   password is expired. Can be done like:
   $ koha-mysql kohadev
   > UPDATE borrowers \
     SET password_expiration_date='2022-04-25' \
     WHERE borrowernumber=132;
   Note: change the borrowernumber
2. Attempt to login to the OPAC with wrong credentials
=> SUCCESS: You are rejected, with a message telling credentials are
            wrong
=> FAIL: You are told the password is expired.
3. Apply this patch and restart Plack
4. Repeat 2
=> SUCCESS: You are rejected, credentials are wrong and no mention to
            password being expired.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: Add tests for API Basic auth behavior
Tomas Cohen Arazi [Mon, 25 Apr 2022 14:05:15 +0000 (11:05 -0300)]
Bug 29924: Add tests for API Basic auth behavior

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: (QA follow-up) Remove password_expiration_date from API
Tomas Cohen Arazi [Mon, 25 Apr 2022 13:43:00 +0000 (10:43 -0300)]
Bug 29924: (QA follow-up) Remove password_expiration_date from API

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29924: Update ILSDI to be aware of expired passwords
Nick Clemens [Wed, 23 Mar 2022 15:58:30 +0000 (15:58 +0000)]
Bug 29924: Update ILSDI to be aware of expired passwords

To test:
1 - Enable ILSDI
2 - Set a patron password with expired password
3 - http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username=usernam&password=password
4 - Confirm 'PasswordExpired' returned

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 29924: (follow-up) Add default value undef for TestBuilder
Nick Clemens [Fri, 25 Feb 2022 18:45:17 +0000 (18:45 +0000)]
Bug 29924: (follow-up) Add default value undef for TestBuilder

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 29924: (follow-up) Add password_expiration_date to API
Nick Clemens [Fri, 11 Feb 2022 13:34:37 +0000 (13:34 +0000)]
Bug 29924: (follow-up) Add password_expiration_date to API

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
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 29924: (follow-up) Add bug number to atomicupdate; Style OPAC message
Owen Leonard [Tue, 25 Jan 2022 15:08:39 +0000 (15:08 +0000)]
Bug 29924: (follow-up) Add bug number to atomicupdate; Style OPAC message

- The atomicupdate didn't have "bug_number" defined.
- The "Your password has expired" message is now styled with the same
  class as other OPAC login messages.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
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 29924: Unit tests
Nick Clemens [Fri, 21 Jan 2022 17:11:39 +0000 (17:11 +0000)]
Bug 29924: Unit tests

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
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 29924: Add password expiration feature
Nick Clemens [Fri, 21 Jan 2022 17:01:10 +0000 (17:01 +0000)]
Bug 29924: Add password expiration feature

This patch adds the ability to define password_expiry_days for a patron
category.

When defined a patron's password will expire after X days and they will
be required to reset their password. If OPAC resets are enabled for the
catgeory they may do so on their own, otherwise they will need to
contact the library

To test:
 1 - Apply patch, updatedatabase
 2 - Set 'Password expiration' for a patron category
     Home-> Administration-> Patron categories-> Edit
 3 - Create a new patron in this category with a userid/password set,
     and an email
 4 - Confirm their password_expiration_date field is set
     SELECT password_expiration_date FROM borrowers WHERE borrowernumber=51;
 5 - Create a new patron, do not set a password
 6 - Confirm their password_expiration_date field is NULL
 7 - Update the patron with an expiration to be expired
     UPDATE borrowers SET password_expiration_date='2022-01-01' WHERE borrowernumber=51;
 8 - Give the borrower catalogue permission
 9 - Attempt to log in to Straff interface
10 - Confirm you are signed out and notified that password must be
     reset
11 - Attempt to sign in to OPAC
12 - Confirm you are signed out and notified password must be reset
13 - Enable password reset for the patron's category and perform a
     password reset
     Note: you will have to find the link in the message_queue unless
     you have emails setup on your test environment
     SELECT * FROM message_queue WHERE borrowernumber=51;
14 - Confirm that you can now sign in and password_expiration_date field
     is set 10 days in the future
15 - Expire the patron's password again
16 - Change the patron's password via the staff interface
17 - Confirm they can sign in and the expiration is updated

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
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 29924: Database updates
Nick Clemens [Fri, 21 Jan 2022 16:59:41 +0000 (16:59 +0000)]
Bug 29924: Database updates

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
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 30563: DBRev 21.12.00.049
Fridolin Somers [Fri, 6 May 2022 19:20:07 +0000 (09:20 -1000)]
Bug 30563: DBRev 21.12.00.049

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30563: (QA follow-up) Fix system preference values and add link to description
Katrin Fischer [Tue, 26 Apr 2022 12:06:59 +0000 (12:06 +0000)]
Bug 30563: (QA follow-up) Fix system preference values and add link to description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30563: (QA follow-up) Fix permission on atomicupdate file
Katrin Fischer [Mon, 25 Apr 2022 16:37:08 +0000 (16:37 +0000)]
Bug 30563: (QA follow-up) Fix permission on atomicupdate file

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30563: Add syspref to make the "cash register" field mandatory
Julian Maurice [Fri, 15 Apr 2022 08:01:00 +0000 (10:01 +0200)]
Bug 30563: Add syspref to make the "cash register" field mandatory

Test plan:
1. Apply patch and run updatedatabase
2. Enable 'UseCashRegisters' syspref and create at least one cash
   register for your library
3. Verify that you have several authorized values in the 'PAYMENT_TYPE'
   category. One of them should be 'CASH'
4. Go to a patron accounting tab, create a manual invoice and go to the
   payment form. Select payment type 'CASH' and verify that you cannot
   submit the form if no cash register is selected.
   Select another payment type and verify that you can submit the form
   even if no cash register is selected
5. Set syspref 'RequireCashRegister' to 'always require a cash register'
6. Repeat step 4 but this time you should not be able to submit the form
   if no cash register is selected, no matter which payment type is
   selected.

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 30467: (QA follow-up) Fix copy paste error to update updated_biblionumbers
Nick Clemens [Fri, 6 May 2022 14:36:07 +0000 (14:36 +0000)]
Bug 30467: (QA follow-up) Fix copy paste error to update updated_biblionumbers

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30467: (QA follow-up) Restore indexing for item only deletion
Martin Renvoize [Fri, 6 May 2022 07:10:04 +0000 (08:10 +0100)]
Bug 30467: (QA follow-up) Restore indexing for item only deletion

This patch restores indexing for item only bulk deletions.

JD amended patch:
* remove trailing whitespaces
* Move if inside first condition

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30467: Don't send the delete request for each item
Jonathan Druart [Wed, 6 Apr 2022 12:11:03 +0000 (14:11 +0200)]
Bug 30467: Don't send the delete request for each item

We are sending the request when all the items have been deleted.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30465: Fix Koha/Items/BatchUpdate.t
Jonathan Druart [Fri, 6 May 2022 07:37:23 +0000 (09:37 +0200)]
Bug 30465: Fix Koha/Items/BatchUpdate.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 28998: (follow-up) Adjust the Auth.t fix
Marcel de Rooy [Fri, 6 May 2022 06:32:51 +0000 (06:32 +0000)]
Bug 28998: (follow-up) Adjust the Auth.t fix

Move the encode_secret call where we need it (when pref is enabled
and patron switches to 2FA).
Mock the koha-conf encryption_key.
Disable 2FA when exiting subtest.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 27470: Improved link text for shibboleth login
ava li [Wed, 20 Jan 2021 02:11:40 +0000 (02:11 +0000)]
Bug 27470: Improved link text for shibboleth login

TEST PLAN:
1) Enable shibboleth by adding shibboleth to koha-conf.xml, you can do
   this by following

   https://wiki.koha-community.org/wiki/Shibboleth_Configuration#Using_AD_FS_Metadata

2) If you are logged in Koha, log out, on the login screen the text
   at the top should say the following, "Log in using a Shibboleth
   account"

Sponsored-by: Catalyst IT
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 29936: (follow-up) Remove useless warining
Tomas Cohen Arazi [Mon, 25 Apr 2022 12:19:06 +0000 (09:19 -0300)]
Bug 29936: (follow-up) Remove useless warining

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29936: Add holds_get_captured option to sip config
Martin Renvoize [Thu, 10 Mar 2022 13:53:17 +0000 (13:53 +0000)]
Bug 29936: Add holds_get_captured option to sip config

This patch adds a new option to the SIP config, allowing for hold
capture to be disabled on difference devices. We still notice the hold
and alert the user, but we do not trigger the update in the system to
mark the hold as found (waiting, processing or in transit).

Sponsored-by: Cheshire Libraries Shared Services
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29936: Add unit tests
Martin Renvoize [Thu, 10 Mar 2022 13:51:58 +0000 (13:51 +0000)]
Bug 29936: Add unit tests

This patch adds a unit test for the new functionality introduced with
holds_get_captured allowing for holds to still be highlighted to patrons
at checkin but not mark them as found/transfered in the system.

Sponsored-by: Cheshire Libraries Shared Services
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30354: Don't assign warn as letter
Nick Clemens [Thu, 24 Mar 2022 15:31:05 +0000 (15:31 +0000)]
Bug 30354: Don't assign warn as letter

TO test:
1 - Check out an item marked for autop renewal to a patron and make it overdue
2 - Set system preference AutoRenewalNotices to follow messaging prefs
3 - set that borrower to receive both email and SMS AUTO_RENEWALS_DGST
4 - confirm your AUTO_RENEWALS_DGST does not have SMS content but does have email
5 - run the auto_renew cron
6 - item is renewed, but error from cron, and cron dies:

No circulation AUTO_RENEWALS_DGST letter transported by sms at /kohadevbox/koha/C4/Letters.pm line 583.
no letter of type 'AUTO_RENEWALS_DGST' found for borrowernumber 5. Please see sample_notices.sql at misc/cronjobs/automatic_renewals.pl line 305.
Can't use string ("1") as a HASH ref while "strict refs" in use at /kohadevbox/koha/C4/Letters.pm line 898.

7 - Apply patch
8 - Make item eligible for auto renewal agian (or checkin/checkout)
9 - Run the cron
10 - There is still 2 warn, but cron does not die:

No circulation AUTO_RENEWALS_DGST letter transported by sms at /kohadevbox/koha/C4/Letters.pm line 583.
no letter of type 'AUTO_RENEWALS_DGST' found for borrowernumber 5. Please see sample_notices.sql at misc/cronjobs/    automatic_renewals.pl line 305.

11 - Patron receives email and item is renewed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30465: Make BatchUpdateBiblio update the index in one request
Jonathan Druart [Wed, 6 Apr 2022 09:38:27 +0000 (11:38 +0200)]
Bug 30465: Make BatchUpdateBiblio update the index in one request

When using the batch record modification tool to modify several
bibliographic records, we don't want to send one index request per
biblio, we want to index them all on the fly after the records have been
modified.
Otherwise we will end up with one task per record, and records will be
indexed in background.

Test plan:
Use the batch mod tool to modify bibliographic records and confirm the
behaviour is correct.

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 30464: Make BatchUpdateAuthority update the index in one request
Jonathan Druart [Wed, 6 Apr 2022 11:45:21 +0000 (13:45 +0200)]
Bug 30464: Make BatchUpdateAuthority update the index in one request

Same as bug 30465 for authorities

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 30460: Make BatchDeleteBiblio update the index in one request
Jonathan Druart [Wed, 6 Apr 2022 11:20:12 +0000 (13:20 +0200)]
Bug 30460: Make BatchDeleteBiblio update the index in one request

No need to send 1 indexation request per item + 1 per biblio.

Test plan:
Confirm that the batch biblio deletion tool still works correctly

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30459: Make BatchDeleteAuthority update the index in one request
Jonathan Druart [Wed, 6 Apr 2022 11:52:40 +0000 (13:52 +0200)]
Bug 30459: Make BatchDeleteAuthority update the index in one request

Same as bug 30460 for authorities

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30291: DBRev 21.12.00.048
Fridolin Somers [Thu, 5 May 2022 19:56:39 +0000 (09:56 -1000)]
Bug 30291: DBRev 21.12.00.048

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30291: Update DBIC schema
Aleisha Amohia [Mon, 28 Mar 2022 09:10:40 +0000 (22:10 +1300)]
Bug 30291: Update DBIC schema

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 30291: (QA follow-up) Fix for revert to recall_id
Martin Renvoize [Thu, 5 May 2022 10:14:44 +0000 (11:14 +0100)]
Bug 30291: (QA follow-up) Fix for revert to recall_id

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30291: (QA follow-up) Keep recall_id column name
Tomas Cohen Arazi [Fri, 29 Apr 2022 11:13:17 +0000 (08:13 -0300)]
Bug 30291: (QA follow-up) Keep recall_id column name

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 30291: Fix permissions
Tomas Cohen Arazi [Fri, 29 Apr 2022 11:02:17 +0000 (08:02 -0300)]
Bug 30291: Fix permissions

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 30291: Changes to OPAC files
Aleisha Amohia [Mon, 28 Mar 2022 12:00:55 +0000 (01:00 +1300)]
Bug 30291: Changes to OPAC files

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 30291: Changes to staff client files
Aleisha Amohia [Mon, 28 Mar 2022 12:00:27 +0000 (01:00 +1300)]
Bug 30291: Changes to staff client files

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 30291: Changes to controller scripts
Aleisha Amohia [Mon, 28 Mar 2022 11:59:18 +0000 (00:59 +1300)]
Bug 30291: Changes to controller scripts

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 30291: Changes to tests
Aleisha Amohia [Mon, 28 Mar 2022 11:57:59 +0000 (00:57 +1300)]
Bug 30291: Changes to tests

t/db_dependent/Circulation.t
t/db_dependent/Circulation/CalcFine.t
t/db_dependent/Circulation/transferbook.t
t/db_dependent/Holds.t
t/db_dependent/Koha/Biblio.t
t/db_dependent/Koha/Item.t
t/db_dependent/Koha/Patron.t
t/db_dependent/Koha/Recall.t
t/db_dependent/Koha/Recalls.t
t/db_dependent/XSLT.t

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 30291: Update boolean flags in Recall schema file
Aleisha Amohia [Mon, 28 Mar 2022 09:12:09 +0000 (22:12 +1300)]
Bug 30291: Update boolean flags in Recall schema file

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 30291: Database changes to recalls table
Aleisha Amohia [Mon, 28 Mar 2022 09:10:14 +0000 (22:10 +1300)]
Bug 30291: Database changes to recalls table

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 29346: (follow-up) Build holds queue when AlterPriority or RevertWaitingStatus...
Nick Clemens [Fri, 29 Apr 2022 00:56:25 +0000 (00:56 +0000)]
Bug 29346: (follow-up) Build holds queue when AlterPriority or RevertWaitingStatus is called

To test:
1 - Place 3 holds on a bib with a single item
2 - Confirm bib shows in holds queue
3 - Check in item and cnofirm hold
4 - Bib is no longer in queue
5 - Revert the waiting status
6 - The hold is in the queue again
7 - Move top hold to bottom
8 - Confirm queue selects hold for new top priorty patron

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Use fully qualified names for C4:Circulation routines in C4::HoldsQueue
Nick Clemens [Fri, 29 Apr 2022 00:28:33 +0000 (00:28 +0000)]
Bug 29346: Use fully qualified names for C4:Circulation routines in C4::HoldsQueue

I suppose this is similar to circular dependency on other patch

HoldsQueue uses Circulation uses BatchUpdateBiblioHoldsQueueuse HoldsQueue

Without this the background job builds the queue, but reports failure:
Holds queue for biblio The Jacobite clans of the Great Glen, 1650-1784 /. An error occurred (Undefined subroutine &C4::HoldsQueue::GetTransfers called at /kohadevbox/koha/C4/HoldsQueue.pm line 351. )

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Remove unused circular dependency on C4::Search
Tomas Cohen Arazi [Thu, 28 Apr 2022 13:59:22 +0000 (10:59 -0300)]
Bug 29346: Remove unused circular dependency on C4::Search

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Add better reporting
Tomas Cohen Arazi [Thu, 28 Apr 2022 13:57:04 +0000 (10:57 -0300)]
Bug 29346: Add better reporting

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: (follow-up) Fix typo 'availabe'
Nick Clemens [Thu, 28 Apr 2022 12:12:34 +0000 (12:12 +0000)]
Bug 29346: (follow-up) Fix typo 'availabe'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: (QA follow-up) Rebuild queue when adjusting priorities of holds
Nick Clemens [Thu, 28 Apr 2022 12:04:40 +0000 (12:04 +0000)]
Bug 29346: (QA follow-up) Rebuild queue when adjusting priorities of holds

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Add more fine-grained control of holds queue updates
Tomas Cohen Arazi [Tue, 26 Apr 2022 19:28:22 +0000 (16:28 -0300)]
Bug 29346: Add more fine-grained control of holds queue updates

This patch deals with the fact that high-level circualtion methods like
`AddIssue`, `AddReturn` and `ModDateLastSeen` all eventually call
lower-level methods like ModBiblio, Koha::Item->store of
UpdateTotalIssues which are expected to trigger holds queue updates (for
the object CRUD operations use cases). As the circulation methods need
to trigger holds queue update as well, duplicate updates were being
requested which is suboptimal, of course.

In order to prevent this, and because circulation methdos could trigger
holds queue updates several times, actually, I added a new parameter
*skip_holds_queue* to the low-level methods, so when they are called
from circulation, the trigger is skipped and we have greater control on
when and how holds queue updates are scheduled.

This patch introduces the `skip_holds_queue` parameter to the following
methods:

* C4::Biblio::ModBiblio
* C4::Biblio::UpdateTotalIssues
* Koha::Item->store

Calls to those methods from the following methods will include the new
parameter, and thus duplicated holds queue updates avoided:

* C4::Circulation::AddIssue
* C4::Circulation::AddReturn
* C4::Items::ModDateLastSeen

Tests are added, to verify that the (mocked) BatchUpdateBiblioHoldsQueue
task is only scheduled once when they are called.

To test:
1. Apply up to the previous patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Biblio.t \
           t/db_dependent/Biblio_holdsqueue.t \
           t/db_dependent/Circulation_holdsqueue.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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Avoid duplicate actions tests
Tomas Cohen Arazi [Tue, 26 Apr 2022 19:28:14 +0000 (16:28 -0300)]
Bug 29346: Avoid duplicate actions tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Highlight double enqueue
Martin Renvoize [Mon, 11 Apr 2022 16:20:11 +0000 (17:20 +0100)]
Bug 29346: Highlight double enqueue

This patch highlights a possible issue with the triggers.. though it may
not actually matter in reality.

I appear to already see test failures before this patch with a double
enqueue of the rebuild for both AddIssue and AddReturn.. I couldn't spot
what was causing that but whilst digging I did find another case where
it could happen as highlighted here...

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: (follow-up) Fix typo
Martin Renvoize [Mon, 11 Apr 2022 15:49:42 +0000 (16:49 +0100)]
Bug 29346: (follow-up) Fix typo

We set biblio_ids in enqueue then referred to biblio_id in process ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Item action trigger
Tomas Cohen Arazi [Wed, 23 Mar 2022 15:36:32 +0000 (12:36 -0300)]
Bug 29346: Item action trigger

This patch makes the following actions trigger a holds queue rebuild for
the related biblio:

- Adding an item
- Updating an item
- Deleting an item

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Biblio actions triggers
Tomas Cohen Arazi [Wed, 23 Mar 2022 14:22:52 +0000 (11:22 -0300)]
Bug 29346: Biblio actions triggers

This patch adds the trigger for the holds queue update on teh following
methods:

- C4::Biblio::DelBiblio
- C4::Biblio::ModBiblio

The ModBiblio use case could be improved by checking if itemtype is one
of the updated attributes... but it felt there was no way to do it
without some overhead. So I leave it as-is.

It also mocks the ->enqueue method in the tests that call DelBiblio and
ModBiblio to avoid breakages [1]

Tests are added to check the trigger is called.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Biblio.t
=> SUCCESS: Tests pass! It means the trigger is triggered :-D
3. Sign off :-D

[1] This breakages could be avoided if we solve Koha/BackgrounJob.pm:101
FIXME.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Circulation actions triggers
Tomas Cohen Arazi [Wed, 16 Mar 2022 21:05:55 +0000 (18:05 -0300)]
Bug 29346: Circulation actions triggers

This patch introduces triggers for real-time updating the holds queue at
check out and check in.

The following high-level methods are involved:

- C4::Circulation::AddIssue
- C4::Circulation::AddReturn

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

Note: I put the tests on a separate file because the other one was too
big already.

Sponsored-by: Montgomery County Public Libraries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Hold actions triggers
Tomas Cohen Arazi [Wed, 16 Mar 2022 20:22:28 +0000 (17:22 -0300)]
Bug 29346: Hold actions triggers

This patch makes several holds related actions schedule the background
job for real-time update of the holds queue.

This actions are:

- place (C4::Reserves::AddReserve)
- fill (Koha::Hold->fill)
- cancel (Koha::Hold->cancel)
- suspend (Koha::Hold->suspend)
- resume (Koha::Hold->resume)

The cancel() action is added a *skip_holds_queue* parameter to skip
triggering the background job entirely. It targets cases like
C4::Biblio::DelBiblio in which all biblio holds are cancelled in a loop.
In that case, we just want to cancel them and let a single backgroung
job take care of the holds queue, once the biblio is deleted.

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

Sponsored-by: Montgomery County Public Libraries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Add holds queue update background job
Tomas Cohen Arazi [Thu, 24 Feb 2022 11:46:20 +0000 (08:46 -0300)]
Bug 29346: Add holds queue update background job

This patch adds a background job that takes care of updating the holds
queue rows for a given list of biblios.

It is designed to be used for real-time batch updating the holds queue
when required. Tasks would be added by the relevant methods under the
right use cases.

Sponsored-by: Montgomery County Public Libraries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29346: Refactor loop code into a subroutine
Tomas Cohen Arazi [Thu, 24 Feb 2022 11:01:53 +0000 (08:01 -0300)]
Bug 29346: Refactor loop code into a subroutine

The CreateQueue() method deletes the holds queue data, fetches some
configuration (branches to use, transport cost matrix) and then loops
through a list of biblionumbers, generating the tmp_holdsqueue and
hold_fill_targets rows for the specified biblio.

This patch simply moves that last bit that is run inside the biblios
loop into a separate sub.

The update_queue_for_biblio sub is designed so it does the exact same
thing it did inside the loop, but also gets added the capability of
querying those parameters if not passed, and it also gets a 'delete'
parameter so it deletes the biblio-specific holds queue rows before
starting to work.

This way, it can be reused to write a background job for real-time holds
queue update :-D

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/HoldsQueue.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass! Behavior is kept!
4. Sign off :-D

Sponsored-by: Montgomery County Public Libraries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30600: Update DBIC schema
Fridolin Somers [Thu, 5 May 2022 00:31:37 +0000 (14:31 -1000)]
Bug 30600: Update DBIC schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30572: (QA follow-up) Fix failing unit test
Martin Renvoize [Thu, 5 May 2022 16:12:29 +0000 (17:12 +0100)]
Bug 30572: (QA follow-up) Fix failing unit test

We changed from 'null' being meainingful to using a tinyint and
explicitly requiring '0'.  This patch simply updates the unit test to
reflect that change.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 30692: Fix progress for ES indexing tasks
Tomas Cohen Arazi [Thu, 5 May 2022 14:07:11 +0000 (11:07 -0300)]
Bug 30692: Fix progress for ES indexing tasks

This patch makes the ES indexing task record progress properly.

To test:
1. Have ES setup
2. Edit a record making any change that would trigger indexing
3. Go to Administration > Background jobs
=> FAIL: The task status is 'Finished' but progress shows '0/1'.
4. Apply this patch
5. Restart the default worker:
   $ koha-worker --restart kohadev
6. Repeat 2 and 3
=> SUCCESS: Things work the same, but progress is '1/1'
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 30360: Make UpdateElasticIndex use the helper methods
Tomas Cohen Arazi [Tue, 5 Apr 2022 08:53:12 +0000 (10:53 +0200)]
Bug 30360: Make UpdateElasticIndex use the helper methods

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>
2 years agoBug 30360: Add methods for dealing with the JSON payload
Tomas Cohen Arazi [Mon, 4 Apr 2022 22:30:59 +0000 (00:30 +0200)]
Bug 30360: Add methods for dealing with the JSON payload

This patch adds high-level methods to handle the JSON payload
(de)serialization as needed. This allows devs implementing background
jobs to abstract themselves from the internals of the jobs handling.

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

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>
2 years agoBug 30360: Add helper methods to Koha::BackgroundJobs
Tomas Cohen Arazi [Fri, 25 Mar 2022 14:52:39 +0000 (11:52 -0300)]
Bug 30360: Add helper methods to Koha::BackgroundJobs

This patch adds some helper methods to ease writing background jobs, and
also making it more consistent/solid.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJob.t
=> SUCCESS: Tests pass. The methods have the expected behaviour.
3. Sign off :-D

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>
2 years agoBug 30693: Javascript broken on request.pl
Owen Leonard [Thu, 5 May 2022 14:21:19 +0000 (14:21 +0000)]
Bug 30693: Javascript broken on request.pl

The holds page in the staff interface has some JavaScript relating to
Bootstrap tabs, but the tabs are not always present on the page. This
leads to a JS error after you have selected the patron for the hold.

This patch adds a check for the tabs container element before executing
the code.

To test, apply the patch and locate a bibliographic record on which to
place a hold.

- On the initial holds screen should see tabs for "Patrons" and "Clubs."
  Both should work correctly.
- Select a patron to place the hold for.
- On the page where you enter hold details (pickup library, hold
  expiration, etc.) there should be no JavaScript error in the console.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 30674: x-koha-override should use collectionFormat: csv
Tomas Cohen Arazi [Tue, 3 May 2022 18:04:54 +0000 (15:04 -0300)]
Bug 30674: x-koha-override should use collectionFormat: csv

This patch makes this header parameter rely on the OpenAPI spec to
validate and document the available options.

Right now the only place is in POST and PUT /holds.

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

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>
2 years agoBug 30663: Implement overrides handling in POST /suggestions
Tomas Cohen Arazi [Tue, 3 May 2022 14:23:23 +0000 (11:23 -0300)]
Bug 30663: Implement overrides handling in POST /suggestions

This patch implements the override checks in the controller as expected
by the previous patch.

To test:
1. Apply this bug patches up to 'Add x-koha-override options...'
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/suggestions.t
=> FAIL: Tests fail! The controller doesn't care about overrides or
         sysprefs about suggestions limits.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Things work!
5. 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>
2 years agoBug 30663: Add x-koha-override options to /suggestions
Tomas Cohen Arazi [Tue, 3 May 2022 14:20:46 +0000 (11:20 -0300)]
Bug 30663: Add x-koha-override options to /suggestions

This patch adds the x-koha-override header parameter to the route that
is used to create suggestions, POST /suggestions.

The idea is that adding suggestions will be rejected under certain
conditions unless x-koha-override is passed with appropriate values. The
added overrides are:

* any
* max_total
* max_pending

Tests are added for the expected behavior.

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>
2 years agoBug 30663: Add Koha::Suggestions helper methods
Tomas Cohen Arazi [Tue, 3 May 2022 14:18:10 +0000 (11:18 -0300)]
Bug 30663: Add Koha::Suggestions helper methods

This patch adds the following helper methods:

* filter_by_pending
* filter_by_suggested_days_range

This methods follow basically what's done in opac-suggestions.pl
I chose 'pending' as opposed to 'open' to follow what we use in the UI
which might be the case because of being more accurate for end users.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Suggestions.t
=> SUCCESS: Tests pass!
3. 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>
2 years agoBug 29616: (QA follow-up) Use /public endpoints on OPAC
Martin Renvoize [Thu, 5 May 2022 12:11:32 +0000 (13:11 +0100)]
Bug 29616: (QA follow-up) Use /public endpoints on OPAC

This patch updates the new modal to use the /public version of the
libraries endpoint for fetching library data. This ensure the feature
works as expected prior to patron login.