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>
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>
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>
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>
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>
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>
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>
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>
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>
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) 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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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:
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
Nick Clemens [Thu, 21 Apr 2022 11:02:54 +0000 (11:02 +0000)]
Bug 30577: Move item specific pickup locations to the left
When placing holds, staff will set the pickup location at the top,
choose an item, then place the hold.
It is easy not to notice the item specific locations dropdown.
This patch moves it in line with the other selction areas on the request screen.
To test:
1 - Find a record on staff client, place hold
2 - Select a patron to load the request screen
3 - Note the location dropdown for next available hold
4 - Note the item specific locations on the far right
5 - Apply patch
6 - Reload the page
7 - Note the item specific location dropdowns are now moved to the left
8 - Place the hold, verify it works with the dropdowns
9 - Verify title levelholds still work as expected
10 - Verify multi-holds still work
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Wed, 6 Apr 2022 18:00:14 +0000 (18:00 +0000)]
Bug 30475: Convert tools pages tabs to Bootstrap (part 2)
This patch converts jQueryUI tabs on three tools templates to Bootstrap
tabs. The patch contains indentation changes, so diff accordingly.
To test, apply the patch and go to Tools -> Export.
- You should see at least two tabs, "Export bibliographic records" and
"Export authority records."
- Confirm that they look correct and work correctly.
Go to Tools -> Batch patron modification.
- Check the "By card number," "By borrowernumber," and "By patron list"
tabs.
Go to Tools -> Overdue notice/status triggers.
- Check the "First," "Second," and "Third" tabs.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Tue, 12 Apr 2022 17:26:03 +0000 (17:26 +0000)]
Bug 30474: (follow-up) Tie editor initialization to tab activation
The way Bootstrap tabs manipulate the DOM, CodeMirror has problems
initializing correctly, I think because of redraws and CodeMirror's
attemps to position things absolutely.
The solution seems to be to wait until after a Bootstrap tab has
activated before initializing the CodeMirror instance. This patch
implements that, along with a check to prevent double-initializing the
same textarea.
I've also made a similar change to the way TinyMCE is initialized, which
I hope will help with the issue of the editor not always loading
correctly.
To test, apply the patch and go to Tools -> HTML customizations.
- Test creation and editing of HTML customization entries using both
the default editor and the text editor (Edit -> Edit with text
editor).
- Verify that the editor (CodeMirror or TinyMCE) loads correctly and
looks correct, both upon page load and upon switching tabs between
"Default" and other language tabs
- Verify that your edits are saved correctly.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Wed, 6 Apr 2022 15:35:47 +0000 (15:35 +0000)]
Bug 30473: Convert suggestions page tabs to Bootstrap
This patch updates the suggestions page to use Bootstrap tabs
instead of jQueryUI.
To test you should have multiple suggestions from different libraries,
different item types, and different statuses.
Apply the patch and go to Suggestions.
- Suggestions should initially be displayed in tabs by status.
- Confirm that the tabs look correct and work correctly.
- Test that tabs work correctly for each option in the "Organize by"
dropdown in the left-hand sidebar.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch adds a temporary deprecation warning to let users know the
plugin needs to get updated before the next release.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Plugins/Holds_hooks.t
=> SUCCESS: Tests pass, warning is displayed
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch adds a new 'after_hold_action' hook, that is called with the
'placed' action parameter.
To test:
1. Apply the unit tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Plugins/Holds_hooks.t
=> FAIL: Boo, the hook is not called
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: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Wed, 15 Dec 2021 09:09:22 +0000 (10:09 +0100)]
Bug 29698: Make items available for PREDUEDGST
With this patch you can access items using:
Number of items [% items.count %]
[% FOR i IN items %]
[% SET checkout = i.checkout %]
Item [% i.itemnumber %] is due on [% checkout.date_due | $KohaDates %]
[% END %]
== test plan ==
1. Add the following to PREDUEDGST and DUEDST:
Number of items [% items.count %]
[% FOR i IN items %]
[% SET checkout = i.checkout %]
Item [% i.itemnumber %] is due on [% checkout.date_due | $KohaDates %]
[% END %]
2. Find a patron and set there messaging prefs 'Item due' and 'Advanced
notices' so they get an email and 'digest only'.
On 'Advanced notices' set Days in advance to 1.
3. Check some things out to a patron and make them due tomorrow.
4. perl /kohadevbox/koha/misc/cronjobs/advance_notices.pl -v -c
5. Check the patrons notices and make sure the PREDUEDGST looks right.
6. Check some things out to a patron and make them due today.
7. Repeat 4.
8. Check the patrons notices and make sure the DUEDGST looks right.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Thu, 14 Apr 2022 18:02:22 +0000 (18:02 +0000)]
Bug 30549: Replace the use of jQueryUI Accordion on pending patron updates page
This patch updates the pending patron updates page to use Bootstrap
collapse instead of jQueryUI.
This patch contains whitespace changes, so view the diff with this in
mind.
To test, apply the patch and rebuild the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).
- If necessary, log into the OPAC and submit an update via the "Your
personal details" page. Ideally do this for two or more patrons.
- In the staff client, follow the "Patrons requesting modifications"
link.
- On the "Update patron records" page you should see the headings
representing each of the patrons with pending updates. The first panel
should be expanded.
- Confirm that the panels expand and collapse correctly.
- Follow the "Patron details" link for one of these patrons.
- Click the "Review pending modifications" link on the patron detail
page.
- When the update page opens that patron's panel should be expanded.
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Thu, 21 Apr 2022 18:17:41 +0000 (18:17 +0000)]
Bug 28138: (follow-up) Add empty option to payment type selection
This patch adds an empty <option> to the "Payment type" selection when
paying fine. This forces the user to actively make a selection. I've
also added the text "None selected" to the other empty <option> on the
page for consistency.
To test, apply the patch and test the pay fine interface with and
without the RequirePaymentType preference enabled. When enabled the
payment type should be required and it should default to "None
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>
Julian Maurice [Tue, 13 Apr 2021 08:06:24 +0000 (10:06 +0200)]
Bug 28138: Add syspref to make the payment type required
The payment type is already required when using the cash register
feature, but some users want to force selecting a payment type even
when cash registers are not used
The new system preference name is RequirePaymentType
Test plan:
1. Apply patch and run updatedatabase.pl
2. Disable UseCashRegisters and RequirePaymentType sysprefs
3. Create some authorised values in PAYMENT_TYPE category if needed
4. Create a manual invoice and pay it. Notice that the payment type is
optional.
5. Enable RequirePaymentType
6. Create a manual invoice and pay it. Notice that the payment type is
now required.
7. Enable UseCashRegisters and verify that the payment type is always
required, even if RequirePaymentType is disabled
Rebased by Thibaud Guillot <thibaud.guillot@biblibre.com> on 21-12-02
Signed-off-by: shiyao <shiyao@inlibro.com> 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>
Bug 30600: Fix recall reasons for branch transfers
When a recall triggers a branch transfer, the reason for the transfer is
'Recall'.
When a transfer is cancelled that was triggered by a recall, depending
on where it is cancelled, will use the 'Manual' or 'CancelRecall'
cancellation reasons.
This patch ensures branchtransfers.cancellation_reason adds 'CancelRecall',
and branchtransfers.reason adds 'Recall' as options.
Sponsored-by: Catalyst IT Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Nick Clemens [Wed, 23 Feb 2022 16:09:07 +0000 (16:09 +0000)]
Bug 30167: Use returned renewal date rather than fetching
This patch updates the three scripts that fetched the soonest renewal date
to use the return from CanBookBeRenewed
To test:
1 - Set a circulation rule with a 'no renewal before' set to 3, loan length set to 5
2 - Check out an item to a patron that uses this rule
3 - Verify the checkouts for the patron show the correct 'No renewal before' date
4 - Sign in to the patron's opac account
5 - Verify the item shows it cannot be renewed, and shows the correct date
6 - Go to Circulation->Renew
7 - Attempt to renew using barcode
8 - Confirm error shows the soonest renewal date
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>
Martin Renvoize [Fri, 22 Apr 2022 09:46:06 +0000 (10:46 +0100)]
Bug 28998: (QA follow-up) Improve output on error
This patch updates the output_and_exit call to instead pass an error
parameter in the template and use it to display the warning instead of
the rest of the page content in the 'Manage two-factor authentication'
page.
This allows for translation and makes the page adhere to normal
practices.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>