Bug 30274

Summary: Non-reservable items should only fill item-level reserves
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Hold requestsAssignee: Julian Maurice <julian.maurice>
Status: Failed QA --- QA Contact: Pedro Amorim <pedro.amorim>
Severity: normal    
Priority: P5 - low CC: alexbuckley, gmcharlt, janet.mcgowan, julian.maurice, pedro.amorim, sharon.dugdale
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23172
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 30274: Prevent non-reservable item to be set as waiting at checkin
Bug 30274: Prevent non-reservable item to be set as waiting at checkin
Bug 30274: Prevent non-reservable item to be set as waiting at checkin

Description Aleisha Amohia 2022-03-11 00:32:19 UTC
For item types where 'holds allowed(total)' equals 0, you can still place reserves on these non-reservable items via the staff client by overriding the circulation rule.

The bug is that, when you check in an item that is non-reservable (holds allowed is 0), it will trigger the holds pop-up and can fill a biblio-level hold ("next available").

The holds pop-up should only be triggered by non-reservable items if there is an item-level reserve on it.
Comment 1 Sharon Dugdale 2023-04-20 13:17:40 UTC
We have just noticed this is happening when a non-reservable item is checked in - KOHA is saying that it is available to satisfy a request.
We have two library services (Public Libraries and Schools Library Service) using the same system and catalogue, though the stock is NOT inter-changeable and the school stock is shadowed on the OPAC. On occasion school stock is returned to a public library by mistake and when these items are checked in, if a request is pending, KOHA makes it available to satisfy it.
The Schools Service does NOT use a request function on KOHA so it would be up to the Public Library staff to identify these errors and ensure these items are NOT trapped for holds.
Within the Public Libraries, we also have unreservable and OPAC shadowed stock which may also be affected.
Comment 2 Julian Maurice 2024-07-08 12:04:33 UTC
Created attachment 168588 [details] [review]
Bug 30274: Prevent non-reservable item to be set as waiting at checkin

Test plan:
1. Create a biblio with 2 items:
  * 1st item:
    * Barcode: ITEM1
    * Item type: TYPE1
    * Homebranch and holdingbranch: LIBRARY
  * 2nd item:
    * Barcode: ITEM2
    * Item type: TYPE2
    * Homebranch and holdingbranch: LIBRARY
2. Create a circulation rule for LIBRARY, TYPE1 with "Holds allowed
   (total)" = 1
3. Create a circulation rule for LIBRARY, TYPE2 with "Holds allowed
   (total)" = 0
4. Place a biblio-level hold on that biblio with a patron from library
   LIBRARY.
5. Check in: ITEM2
   Without the patch, the "Hold found" popup appears, allowing you to
   confirm hold for a non-reservable item
   With the patch, no popup appears.
Comment 3 Roman Dolny 2024-07-30 18:49:56 UTC
Created attachment 169874 [details] [review]
Bug 30274: Prevent non-reservable item to be set as waiting at checkin

Test plan:
1. Create a biblio with 2 items:
  * 1st item:
    * Barcode: ITEM1
    * Item type: TYPE1
    * Homebranch and holdingbranch: LIBRARY
  * 2nd item:
    * Barcode: ITEM2
    * Item type: TYPE2
    * Homebranch and holdingbranch: LIBRARY
2. Create a circulation rule for LIBRARY, TYPE1 with "Holds allowed
   (total)" = 1
3. Create a circulation rule for LIBRARY, TYPE2 with "Holds allowed
   (total)" = 0
4. Place a biblio-level hold on that biblio with a patron from library
   LIBRARY.
5. Check in: ITEM2
   Without the patch, the "Hold found" popup appears, allowing you to
   confirm hold for a non-reservable item
   With the patch, no popup appears.
Comment 4 Roman Dolny 2024-07-30 18:51:54 UTC
Created attachment 169875 [details] [review]
Bug 30274: Prevent non-reservable item to be set as waiting at checkin

Test plan:
1. Create a biblio with 2 items:
  * 1st item:
    * Barcode: ITEM1
    * Item type: TYPE1
    * Homebranch and holdingbranch: LIBRARY
  * 2nd item:
    * Barcode: ITEM2
    * Item type: TYPE2
    * Homebranch and holdingbranch: LIBRARY
2. Create a circulation rule for LIBRARY, TYPE1 with "Holds allowed
   (total)" = 1
3. Create a circulation rule for LIBRARY, TYPE2 with "Holds allowed
   (total)" = 0
4. Place a biblio-level hold on that biblio with a patron from library
   LIBRARY.
5. Check in: ITEM2
   Without the patch, the "Hold found" popup appears, allowing you to
   confirm hold for a non-reservable item
   With the patch, no popup appears.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 5 Pedro Amorim 2024-08-01 15:56:55 UTC
The patch is causing tests to fail:

prove t/db_dependent/Circulation.t
t/db_dependent/Circulation.t .. 70/75 
    #   Failed test 'Branchcodes match when hold exists.'
    #   at t/db_dependent/Circulation.t line 6622.
    #          got: undef
    #     expected: 'fPd0uu'
    # Looks like you failed 1 test of 4.

#   Failed test 'CanBookBeIssued + needsconfirmation message'
#   at t/db_dependent/Circulation.t line 6637.
t/db_dependent/Circulation.t .. 75/75 # Looks like you failed 1 test of 75.
t/db_dependent/Circulation.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/75 subtests 

Test Summary Report
-------------------
t/db_dependent/Circulation.t (Wstat: 256 (exited 1) Tests: 75 Failed: 1)
  Failed test:  71
  Non-zero exit status: 1
Files=1, Tests=75, 40 wallclock secs ( 0.07 usr  0.02 sys + 23.51 cusr 12.90 csys = 36.50 CPU)
Result: FAIL