Bug 39820

Summary: Items with hold cancellation requests should have the hold cancelled when checked in via SIP
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: SIP2Assignee: Lucas Gass (lukeg) <lucas>
Status: Signed Off --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: david, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes checking in items using SIP, and there is a hold cancellation request - the hold is now cancelled. Before this, it did not cancel the hold and it was still listed under "Holds with cancellation requests" (Circulation > Holds > Holds awaiting pickup).
Version(s) released in:
Circulation function:
Attachments: Bug 39820: Cancel holds with cancellation requests via SIP
Bug 39820: Cancel holds with cancellation requests via SIP
Bug 39820: Cancel holds with cancellation requests via SIP
Bug 39820: (QA follow-up) Unit tests
Bug 39820: Add cancellation reason and clean up cancellation request

Description Lucas Gass (lukeg) 2025-05-02 16:19:41 UTC
To recreate:
1. In circ rules set a Default waiting hold cancellation policy to allow hold cancellation requests. 
2. Add a hold for a patron and create a hold cancellation request.
3. Check the item in via SIP, I used the SIP emulator:

kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l MPL -su term1 -sp term1 -m checkin --patron 23529000035676 --item 39999000001310

4. The hold remains.

In the staff client if I check in an item with a hold cancellation request the hold is cancelled
Comment 1 Lucas Gass (lukeg) 2025-05-06 21:23:36 UTC
Created attachment 181999 [details] [review]
Bug 39820: Cancel holds with cancellation requests via SIP

To test:
1. In circ rules set a Default waiting hold cancellation policy to allow hold cancellation requests.
2. Add a hold for a patron and create a hold cancellation request.
3. Check the item in via SIP, I used the SIP emulator:

kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l MPL -su term1 -sp term1 -m checkin --patron 23529000035676 --item 39999000001310

4. The hold remains.
5. APPLY PATCH, restart_all
6. Try 2 - 4 again, the hold should be cancelled
Comment 2 David Nind 2025-05-08 17:27:28 UTC
Created attachment 182105 [details] [review]
Bug 39820: Cancel holds with cancellation requests via SIP

To test:
1. In circ rules set a Default waiting hold cancellation policy to allow hold cancellation requests.
2. Add a hold for a patron and create a hold cancellation request.
3. Check the item in via SIP, I used the SIP emulator:

kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l MPL -su term1 -sp term1 -m checkin --patron 23529000035676 --item 39999000001310

4. The hold remains.
5. APPLY PATCH, restart_all
6. Try 2 - 4 again, the hold should be cancelled

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2025-05-08 18:06:32 UTC
Testing notes (using KTD):
1. For step 2, check the item in so that the hold is waiting for pickup.
2. For step 3, change the command to reflect your library, patron, and item (I used Mary Burton + Perl programming - 39999000011418):
   - MPL --> CPL
   - --patron 23529000035676 --> --patron 23529000651225
   - --item 39999000001310 --> --item 39999000011418
Comment 4 Martin Renvoize (ashimema) 2025-05-12 13:50:25 UTC
Created attachment 182276 [details] [review]
Bug 39820: Cancel holds with cancellation requests via SIP

To test:
1. In circ rules set a Default waiting hold cancellation policy to allow hold cancellation requests.
2. Add a hold for a patron and create a hold cancellation request.
3. Check the item in via SIP, I used the SIP emulator:

kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l MPL -su term1 -sp term1 -m checkin --patron 23529000035676 --item 39999000001310

4. The hold remains.
5. APPLY PATCH, restart_all
6. Try 2 - 4 again, the hold should be cancelled

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 5 Martin Renvoize (ashimema) 2025-05-12 13:50:28 UTC
Created attachment 182277 [details] [review]
Bug 39820: (QA follow-up) Unit tests

This patch adds unit tests.. but it also adds some FIXME and QUESTION
statements to those tests
Comment 6 Martin Renvoize (ashimema) 2025-05-12 13:51:55 UTC
Afraid whilst writing unit tests for this I had questions...

1) Should we be passing anything to the cancel call (cancellation reason for example)
2) Should we be cleaning up the cancellation requests?

Failing QA whilst we get answers to those questions.
Comment 7 Lucas Gass (lukeg) 2025-07-03 20:27:58 UTC
Created attachment 183776 [details] [review]
Bug 39820: Add cancellation reason and clean up cancellation request