Bug 26591

Summary: Add a choice to prevent the checkout or warn the user if CheckPrevCheckout is used via SIP2
Product: Koha Reporter: Koha Team University Lyon 3 <koha>
Component: SIP2Assignee: Matthias Meusburger <matthias.meusburger>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: andrewfh, colin.campbell, dcook, fridolin.somers, jheltibridle, jonathan.druart, katrin.fischer, koha, liz, m.de.rooy, martin.renvoize, matthias.meusburger
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26937
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Some libraries would like patrons to be able to check out items with prior checkouts via SIP even if the CheckPrevIssue preference is enabled. This feature is enabled by adding the flag prevcheckout_block_checkout to an account in the SIP configuration file, and setting the value of it to "0".
Version(s) released in:
21.05.00,20.11.04
Bug Depends on: 19457    
Bug Blocks:    
Attachments: Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

Description Koha Team University Lyon 3 2020-10-01 09:03:03 UTC
Since BZ19457, the checkout is allowed at the selfcheckout system if if we use the system preference CheckPrevCheckout. It can be useful for some libraries but not for the others. For example, in my libray, we want to prevent users who are using the selfcheckout system to checkout an item they have just check-in. They didn't really matter the warning and they can keep a book for all the time. For some title, there's a real pressure becaus they are recommanded by the teachers and we can't have one for all the students.
The behaviour should be configurable.
Comment 1 Matthias Meusburger 2020-11-04 08:24:13 UTC
Created attachment 112975 [details] [review]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Prove t/db_dependent/SIP/Message.t
Comment 2 Kyle M Hall 2020-11-04 12:06:42 UTC
Created attachment 112986 [details] [review]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Prove t/db_dependent/SIP/Message.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Jonathan Druart 2020-11-04 12:11:27 UTC
Matthias, please provide a complete test plan. Prove is not enough here.
Comment 4 Matthias Meusburger 2020-11-04 13:29:27 UTC
Sure thing!
Comment 5 Matthias Meusburger 2020-11-04 13:30:23 UTC
Created attachment 112991 [details] [review]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Enable the CheckPrevCheckout syspref (on "Do" for instance)
  3) Enable prevcheckout_block_checkout in the SIP server config file
  4) Checkout and checkin an item for a user
  5) Checkout the item again with the SIP CLI tool
  6) Check that the SIP message is "This item was previously checked out by you"
     and that the item was not checked out
  7) Disable prevcheckout_block_checkout in the SIP server config file
  8) Checkout the item again with the SIP CLI tool
  9) Check that the SIP message is "This item was previously checked out by you"
     and that the item was checked out.
 10) Prove t/db_dependent/SIP/Message.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Marcel de Rooy 2021-01-29 09:17:29 UTC
If I understand correctly, this SIP setting goes further than the corresponding system preference.
My question is here: Should this be something only "hidden deeper" in the SIP config file, or should it actually be a system preference and have the same effect in the staff client ?
Comment 7 Marcel de Rooy 2021-01-29 09:19:42 UTC
Adding a few users from bug 19457 for comment6
Comment 8 Matthias Meusburger 2021-01-29 09:33:00 UTC
(In reply to Marcel de Rooy from comment #6)
> If I understand correctly, this SIP setting goes further than the
> corresponding system preference.
> My question is here: Should this be something only "hidden deeper" in the
> SIP config file, or should it actually be a system preference and have the
> same effect in the staff client ?

One answer to this question can be the same that Kyle made here: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25541#c4

"The problem with a syspref though is that the behavior cannot be changed on a per-account basis. It very well may be that such behavior is desired for a self check machine for example, but not for an AMH."
Comment 9 Martin Renvoize 2021-02-23 15:33:44 UTC
Created attachment 117210 [details] [review]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Enable the CheckPrevCheckout syspref (on "Do" for instance)
  3) Enable prevcheckout_block_checkout in the SIP server config file
  4) Checkout and checkin an item for a user
  5) Checkout the item again with the SIP CLI tool
  6) Check that the SIP message is "This item was previously checked out by you"
     and that the item was not checked out
  7) Disable prevcheckout_block_checkout in the SIP server config file
  8) Checkout the item again with the SIP CLI tool
  9) Check that the SIP message is "This item was previously checked out by you"
     and that the item was checked out.
 10) Prove t/db_dependent/SIP/Message.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2021-02-23 15:37:13 UTC
Created attachment 117211 [details] [review]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Enable the CheckPrevCheckout syspref (on "Do" for instance)
  3) Enable prevcheckout_block_checkout in the SIP server config file
  4) Checkout and checkin an item for a user
  5) Checkout the item again with the SIP CLI tool
  6) Check that the SIP message is "This item was previously checked out by you"
     and that the item was not checked out
  7) Disable prevcheckout_block_checkout in the SIP server config file
  8) Checkout the item again with the SIP CLI tool
  9) Check that the SIP message is "This item was previously checked out by you"
     and that the item was checked out.
 10) Prove t/db_dependent/SIP/Message.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize 2021-02-23 15:37:57 UTC
This patch follows the same logic as bug 25541 and allows override of the CheckPrevIssue at the sip account level.

Tested and working as expected with new unit tests passing.

I've added the new option to the Wiki page as required (https://wiki.koha-community.org/wiki/SIP2_configuration) and fixed a tab character that was failing the QA script.

Passing QA
Comment 12 Jonathan Druart 2021-03-01 14:24:09 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 13 Fridolin Somers 2021-03-04 10:23:40 UTC
Small useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.04
Comment 14 Andrew Fuerste-Henry 2021-03-14 18:29:17 UTC
Enhancement, not backported to 20.05