Bug 29969

Summary: Cannot update hold list after holds cancelled in bulk
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Hold requestsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrewfh, david, fridolin.somers, gmcharlt, kyle, nick, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28782
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00
Bug Depends on: 23678    
Bug Blocks:    
Attachments: Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
Bug 30089: (bug 29844 follow-up) Fix placing holds - OPAC

Description Jonathan Druart 2022-01-28 13:42:56 UTC
If you cancel holds in bulk, the list is not updated as we enqueued the task. But the "Update hold(s)" button will explode if clicked:

Can't call method "found" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1060.                                                                                                                        
 at /kohadevbox/koha/C4/Reserves.pm line 1057                                                                                                                                                                        
        C4::Reserves::ModReserve('HASH(0x5583dff297d8)') called at /kohadevbox/koha/reserve/modrequest.pl line 87
Comment 1 Jonathan Druart 2022-01-28 14:08:36 UTC
Created attachment 129948 [details] [review]
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation

If you cancel holds in bulk, the list is not updated as we enqueued the
task. But the "Update hold(s)" button will explode if clicked.

Test plan:
Place several holds on a bib record
Use the "Cancel selected" link to cancel holds in bulk
The job is enqueued and the hold list still show the holds you cancelled
Click "Update holds"
=> Without this patch you get an ugly 500
Can't call method "found" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1060
=> With this patch applied the table is refresh, no crash (and there is
a warning in the log, that may not be necessary)
Comment 2 David Nind 2022-01-30 18:21:44 UTC
Patch no longer applies 8-(...

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
error: sha1 information is lacking or useless (C4/Reserves.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Comment 3 Jonathan Druart 2022-01-31 10:15:54 UTC
Created attachment 129990 [details] [review]
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation

If you cancel holds in bulk, the list is not updated as we enqueued the
task. But the "Update hold(s)" button will explode if clicked.

Test plan:
Place several holds on a bib record
Use the "Cancel selected" link to cancel holds in bulk
The job is enqueued and the hold list still show the holds you cancelled
Click "Update holds"
=> Without this patch you get an ugly 500
Can't call method "found" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1060
=> With this patch applied the table is refresh, no crash (and there is
a warning in the log, that may not be necessary)
Comment 4 Tomás Cohen Arazi 2022-01-31 16:17:19 UTC
Created attachment 130017 [details] [review]
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation

If you cancel holds in bulk, the list is not updated as we enqueued the
task. But the "Update hold(s)" button will explode if clicked.

Test plan:
Place several holds on a bib record
Use the "Cancel selected" link to cancel holds in bulk
The job is enqueued and the hold list still show the holds you cancelled
Click "Update holds"
=> Without this patch you get an ugly 500
Can't call method "found" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1060
=> With this patch applied the table is refresh, no crash (and there is
a warning in the log, that may not be necessary)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Nick Clemens 2022-02-18 15:38:23 UTC
Created attachment 130865 [details] [review]
Bug 30089: (bug 29844 follow-up) Fix placing holds - OPAC

The method Koha::AuthorisedValues->authorised_value is not covered by tests!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Fridolin Somers 2022-02-22 00:44:40 UTC
(In reply to Nick Clemens from comment #5)
> Created attachment 130865 [details] [review] [review]
> Bug 30089: (bug 29844 follow-up) Fix placing holds - OPAC
> 
> The method Koha::AuthorisedValues->authorised_value is not covered by tests!
> 
> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
> 
> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Ich, wrong bug Nick :D
Comment 7 Fridolin Somers 2022-02-22 01:14:39 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 8 Andrew Fuerste-Henry 2022-03-07 21:05:24 UTC
Missing dependency, not backported to 21.05