Bug 28644

Summary: Can't call method "borrowernumber" on an undefined value at C4/Reserves.pm line 607
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Hold requestsAssignee: Marcel de Rooy <m.de.rooy>
Status: Pushed to oldoldoldstable --- QA Contact: Nick Clemens <nick>
Severity: trivial    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle, nick, victor, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.02,20.11.09,20.05.15,19.11.22
Attachments: Bug 28644: Fix calling borrowernumber on undefined value
Bug 28644: Fix calling borrowernumber on undefined value
Bug 28644: [19.11.x] Fix calling borrowernumber on undefined value

Description Marcel de Rooy 2021-07-01 14:08:44 UTC
Got this one under 19.11 on line 521
Looks like someone tried to cancel an already cancelled hold from the opac (in the user menu).
Trivial fix.
Comment 1 Marcel de Rooy 2021-07-01 14:18:55 UTC
Created attachment 122518 [details] [review]
Bug 28644: Fix calling borrowernumber on undefined value

If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2021-07-01 14:19:21 UTC
Self signoff; too trivial to wait for.
Comment 3 Nick Clemens 2021-07-09 12:20:28 UTC
Created attachment 122735 [details] [review]
Bug 28644: Fix calling borrowernumber on undefined value

If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Jonathan Druart 2021-07-12 13:49:58 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 5 Kyle M Hall 2021-07-16 12:23:23 UTC
Pushed to 21.05.x for 21.05.02
Comment 6 Fridolin Somers 2021-08-02 21:34:18 UTC
Pushed to 20.11.x for 20.11.09
Comment 7 Victor Grousset/tuxayo 2021-08-16 18:31:09 UTC
Backported: Pushed to 20.05.x branch for 20.05.15
Comment 8 wainuiwitikapark 2021-08-17 00:31:03 UTC
Should this be backported to 19.11.x for 19.11.21?

Or if it contains string changes, backported to 19.11.22? As we are currently in a string freeze.
Comment 9 wainuiwitikapark 2021-09-07 01:46:08 UTC
Should this be backported to 19.11.x for 19.11.22?
Comment 10 Nick Clemens 2021-09-07 10:59:36 UTC
Created attachment 124571 [details] [review]
Bug 28644: [19.11.x] Fix calling borrowernumber on undefined value

If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 wainuiwitikapark 2021-09-08 02:29:59 UTC
Backported to 19.11.x for 19.11.22