Bug 26937

Summary: Add an optional delay to the CheckPrevCheckout system preference
Product: Koha Reporter: Matthias Meusburger <matthias.meusburger>
Component: CirculationAssignee: Matthias Meusburger <matthias.meusburger>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, sally.healey
Version: MainKeywords: Manual-updated
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26591
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This adds a new system preference CheckPrevCheckoutDelay that allows to specify a number of days that is used with the CheckPrevCheckout feature to determine, if a warning should be shown or not. If the checkin date of the item that is about to be checked out is longer ago than CheckPrefCheckoutDelay days, no warning will be displayed.
Version(s) released in:
21.05.00
Circulation function:
Attachments: Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.
Bug 26937: (QA follow-up) Rephrase and link CheckPrevCheckoutDelay description

Description Matthias Meusburger 2020-11-05 13:04:55 UTC
The CheckPrevCheckout system preference allows to check a borrower's checkout history to see if the current item has been checked out before.
     
It would be nice to be able to specify the maximum number of days since the last checkin that will trigger CheckPrevCheckout's warning.
Comment 1 Matthias Meusburger 2020-11-05 13:08:04 UTC
Created attachment 113101 [details] [review]
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.

The CheckPrevCheckout allows to check a borrower's checkout history to see if
the current item has been checked out before.

This patch adds an optional syspref: CheckPrevCheckoutDelay

It allows to specify the maximum number of days since the last checkin
that will trigger CheckPrevCheckout's warning.

Test plan:

 - Apply the patch.

 - Set CheckPrevCheckout to "Do" and CheckPrevCheckoutDelay to n.

 - Checkout and check-in an item for a patron.

 - Try to checkout the same item.

 - Check that you have a warning:
   "Patron has previously checked out this title: Check out anyway?"

 - Update the returndate column from the old_issues table to have a returndate
   older than n days ago.

 - Try to checkout the same item.

 - Check that you don't have the warning.

 - Prove t/db_dependent/Patron/Borrower_PrevCheckout.t
Comment 2 Matthias Meusburger 2020-11-05 13:11:52 UTC
Created attachment 113102 [details] [review]
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.

The CheckPrevCheckout allows to check a borrower's checkout history to see if
the current item has been checked out before.

This patch adds an optional syspref: CheckPrevCheckoutDelay

It allows to specify the maximum number of days since the last checkin
that will trigger CheckPrevCheckout's warning.

Test plan:

 - Apply the patch.

 - Set CheckPrevCheckout to "Do" and CheckPrevCheckoutDelay to n.

 - Checkout and check-in an item for a patron.

 - Try to checkout the same item.

 - Check that you have a warning:
   "Patron has previously checked out this title: Check out anyway?"

 - Update the returndate column from the old_issues table to have a returndate
   older than n days ago.

 - Try to checkout the same item.

 - Check that you don't have the warning.

 - Prove t/db_dependent/Patron/Borrower_PrevCheckout.t
Comment 3 ByWater Sandboxes 2020-11-10 11:09:46 UTC
Created attachment 113343 [details] [review]
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.

The CheckPrevCheckout allows to check a borrower's checkout history to see if
the current item has been checked out before.

This patch adds an optional syspref: CheckPrevCheckoutDelay

It allows to specify the maximum number of days since the last checkin
that will trigger CheckPrevCheckout's warning.

Test plan:

 - Apply the patch.

 - Set CheckPrevCheckout to "Do" and CheckPrevCheckoutDelay to n.

 - Checkout and check-in an item for a patron.

 - Try to checkout the same item.

 - Check that you have a warning:
   "Patron has previously checked out this title: Check out anyway?"

 - Update the returndate column from the old_issues table to have a returndate
   older than n days ago.

 - Try to checkout the same item.

 - Check that you don't have the warning.

 - Prove t/db_dependent/Patron/Borrower_PrevCheckout.t

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 4 Sally 2020-11-10 11:11:31 UTC
Works as expected, signed off.  

NB. If you're using a sandbox to test, you can perform this step:

Update the returndate column from the old_issues table to have a returndate older than n days ago.

by using the 'Specify return date' option in Circulation > Check in
Comment 5 Katrin Fischer 2021-02-15 22:30:14 UTC
Created attachment 116904 [details] [review]
Bug 26937: Add an optional delay to the CheckPrevCheckout syspref.

The CheckPrevCheckout allows to check a borrower's checkout history to see if
the current item has been checked out before.

This patch adds an optional syspref: CheckPrevCheckoutDelay

It allows to specify the maximum number of days since the last checkin
that will trigger CheckPrevCheckout's warning.

Test plan:

 - Apply the patch.

 - Set CheckPrevCheckout to "Do" and CheckPrevCheckoutDelay to n.

 - Checkout and check-in an item for a patron.

 - Try to checkout the same item.

 - Check that you have a warning:
   "Patron has previously checked out this title: Check out anyway?"

 - Update the returndate column from the old_issues table to have a returndate
   older than n days ago.

 - Try to checkout the same item.

 - Check that you don't have the warning.

 - Prove t/db_dependent/Patron/Borrower_PrevCheckout.t

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2021-02-15 22:30:18 UTC
Created attachment 116905 [details] [review]
Bug 26937: (QA follow-up) Rephrase and link CheckPrevCheckoutDelay description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2021-02-15 22:41:31 UTC
Tried to write release notes, a native speaker might be able to improve them.
Comment 8 Jonathan Druart 2021-02-16 09:52:29 UTC
Does it make sense to have a global setting when the check prev checkout feature can be tweak at 3 different levels (pref, patron's category, individual patron)?
Comment 9 Katrin Fischer 2021-02-18 11:47:49 UTC
I think as this is about the general behaviour, not an on/off switch starting on a global level would be perfectly fine. It would be possible to extend this to granular if there is a need later without having to disrupt any existing workflows.
Comment 10 Jonathan Druart 2021-03-01 14:24:12 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 Fridolin Somers 2021-03-04 10:38:02 UTC
Nice enhancement.

I'm not sure about backport to stable, see comment 8.

Without this pref, this delay depends on issues anonymize, if I understand well the code.
Comment 12 Katrin Fischer 2021-03-04 10:52:37 UTC
I think this is a clear enhancement of an existing feature and should not be backported.