Bug 40755

Summary: Hold cancellation requests cause error 500 on holds waiting page
Product: Koha Reporter: Emily Lamancusa (emlam) <emily.lamancusa>
Component: Hold requestsAssignee: Emily Lamancusa (emlam) <emily.lamancusa>
Status: Needs documenting --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: critical    
Priority: P5 - low CC: fridolin.somers, gmcharlt, jonathan.druart, lisette, tomascohen
Version: MainKeywords: regression, rel_25_05_candidate
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.04
Circulation function:
Bug Depends on: 38714    
Bug Blocks:    
Attachments: Bug 40755: Fix typo in waiting_holds.inc
Bug 40755: Fix typo in waiting_holds.inc
Bug 40755: Fix typo in waiting_holds.inc

Description Emily Lamancusa (emlam) 2025-09-04 13:29:10 UTC
To reproduce:

1. Enable hold cancellation requests from the OPAC
   i. Go to Administration > Circulation and Fines rules
   ii. In the "Default waiting hold cancellation policy" section, add the rule:
       All / All / Yes
2. Place at least two holds for pickup at the logged-in library (for ease of testing, place both holds for the same patron)
3. Check in items for both holds and confirm to set holds to Waiting
4. Log into the OPAC as the patron from step 2
5. Go to the patron's holds tab and request cancellation for both holds
6. In the staff interface, go to Circulation > Holds awaiting pickup
==> Error 500! :(

Also, the logs contain the error:
==> /var/log/koha/montgomerytest/plack-error.log <==
Template process failed: undef error - The method Koha::Hold::CancellationRequest->0 is not covered by tests!

Trace begun at /usr/share/koha/lib/Koha/Object.pm line 1042
Koha::Object::AUTOLOAD('Koha::Hold::CancellationRequest=HASH(0x55609e31c2c0)') called at /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/includes/waiting_holds.inc line 40

It looks like this was caused by a typo in bug 38714 - cancellation_request.0 (object) instead of cancellation_requests.0 (list).
Comment 1 Emily Lamancusa (emlam) 2025-09-04 13:44:46 UTC
Created attachment 186153 [details] [review]
Bug 40755: Fix typo in waiting_holds.inc

Fix a typo that caused an error 500 on the holds awaiting pickup page
when there are holds with cancellation requests.

To test:
1. Enable hold cancellation requests from the OPAC
   i. Go to Administration > Circulation and Fines rules
   ii. In the "Default waiting hold cancellation policy" section, add the rule:
       All / All / Yes
2. Place at least two holds for pickup at the logged-in library (for ease of testing, place both holds for the same patron)
3. Check in items for both holds and confirm to set holds to Waiting
4. Log into the OPAC as the patron from step 2
5. Go to the patron's holds tab and request cancellation for both holds
6. In the staff interface, go to Circulation > Holds awaiting pickup
==> Error 500! :(
7. Apply patch and refresh the page
==> The page loads! :)

Bonus testing (KTD only):
1. Edit one of the cancellation request dates, so that they are not both
   the same date:
   ktd --shell
   koha-mysql kohadev
   SELECT * FROM hold_cancellation_requests;
   UPDATE hold_cancellation_requests SET creation_date=<date> WHERE hold_cancellation_request_id = <id>;
2. Refresh the Holds awaiting pickup page again, and switch to the Holds
   with cancellation requests tab
3. Sort by hold cancellation request date and confirm the sorting works
   correctly
Comment 2 Lucas Gass (lukeg) 2025-09-04 15:44:21 UTC
Created attachment 186167 [details] [review]
Bug 40755: Fix typo in waiting_holds.inc

Fix a typo that caused an error 500 on the holds awaiting pickup page
when there are holds with cancellation requests.

To test:
1. Enable hold cancellation requests from the OPAC
   i. Go to Administration > Circulation and Fines rules
   ii. In the "Default waiting hold cancellation policy" section, add the rule:
       All / All / Yes
2. Place at least two holds for pickup at the logged-in library (for ease of testing, place both holds for the same patron)
3. Check in items for both holds and confirm to set holds to Waiting
4. Log into the OPAC as the patron from step 2
5. Go to the patron's holds tab and request cancellation for both holds
6. In the staff interface, go to Circulation > Holds awaiting pickup
==> Error 500! :(
7. Apply patch and refresh the page
==> The page loads! :)

Bonus testing (KTD only):
1. Edit one of the cancellation request dates, so that they are not both
   the same date:
   ktd --shell
   koha-mysql kohadev
   SELECT * FROM hold_cancellation_requests;
   UPDATE hold_cancellation_requests SET creation_date=<date> WHERE hold_cancellation_request_id = <id>;
2. Refresh the Holds awaiting pickup page again, and switch to the Holds
   with cancellation requests tab
3. Sort by hold cancellation request date and confirm the sorting works
   correctly

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Jonathan Druart 2025-09-05 03:45:13 UTC
Created attachment 186188 [details] [review]
Bug 40755: Fix typo in waiting_holds.inc

Fix a typo that caused an error 500 on the holds awaiting pickup page
when there are holds with cancellation requests.

To test:
1. Enable hold cancellation requests from the OPAC
   i. Go to Administration > Circulation and Fines rules
   ii. In the "Default waiting hold cancellation policy" section, add the rule:
       All / All / Yes
2. Place at least two holds for pickup at the logged-in library (for ease of testing, place both holds for the same patron)
3. Check in items for both holds and confirm to set holds to Waiting
4. Log into the OPAC as the patron from step 2
5. Go to the patron's holds tab and request cancellation for both holds
6. In the staff interface, go to Circulation > Holds awaiting pickup
==> Error 500! :(
7. Apply patch and refresh the page
==> The page loads! :)

Bonus testing (KTD only):
1. Edit one of the cancellation request dates, so that they are not both
   the same date:
   ktd --shell
   koha-mysql kohadev
   SELECT * FROM hold_cancellation_requests;
   UPDATE hold_cancellation_requests SET creation_date=<date> WHERE hold_cancellation_request_id = <id>;
2. Refresh the Holds awaiting pickup page again, and switch to the Holds
   with cancellation requests tab
3. Sort by hold cancellation request date and confirm the sorting works
   correctly

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2025-09-05 03:45:41 UTC
Oops, sorry about that.

Thanks for the patch, Emily!
Comment 5 Lucas Gass (lukeg) 2025-09-05 14:07:22 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Paul Derscheid 2025-09-20 08:59:46 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 7 Fridolin Somers 2025-10-10 14:46:18 UTC
Depends on Bug 38714 not in 24.11.x