Bug 30630

Summary: Checking in a waiting hold at another branch when HoldsAutoFill is enabled causes errors
Product: Koha Reporter: Nick Clemens <nick>
Component: Hold requestsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: gmcharlt, jonathan.druart, kyle, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Martin Renvoize Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.06,21.05.16
Bug Depends on: 23070    
Bug Blocks:    
Attachments: Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON

Description Nick Clemens 2022-04-27 15:28:09 UTC

    
Comment 1 Nick Clemens 2022-04-27 15:31:27 UTC
To recreate:
1 - Enable HoldsAutoFill
2 - Place a title level hold
3 - Check in an item and confirm hold
4 - Switch to another branch
5 - Checkin the item, get an error:
Can't call method "biblionumber" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1577.
 at /kohadevbox/koha/C4/Reserves.pm line 1576
6- This causes lingering issues because the hold is now in-transit but has no itemnumber

Root seems to be in circ/returns.pl:
477         ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_    id}, $desk_id );


RevertWaitingStatus has already removed the itemnumber from the hold, passing $itemnumber (from scanned item) should work, as it will reattach the hold to the item
Comment 2 Jonathan Druart 2022-04-28 07:40:40 UTC
yes, *should* :)
Comment 3 Jonathan Druart 2022-04-28 07:46:44 UTC
Created attachment 134203 [details] [review]
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON

RevertWaitingStatus has already removed the itemnumber from the hold, passing $itemnumber (from scanned item) should work, as it will reattach the hold to the item

Test plan:
1 - Enable HoldsAutoFill
2 - Place a title level hold
3 - Check in an item and confirm hold
4 - Switch to another branch
5 - Checkin the item
Without this patch you got
Can't call method "biblionumber" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1577.
 at /kohadevbox/koha/C4/Reserves.pm line 1576
With this patch applied the operation succeeds
Comment 4 David Nind 2022-04-28 09:21:19 UTC
Created attachment 134208 [details] [review]
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON

RevertWaitingStatus has already removed the itemnumber from the hold, passing $itemnumber (from scanned item) should work, as it will reattach the hold to the item

Test plan:
1 - Enable HoldsAutoFill
2 - Place a title level hold
3 - Check in an item and confirm hold
4 - Switch to another branch
5 - Checkin the item
Without this patch you got
Can't call method "biblionumber" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1577.
 at /kohadevbox/koha/C4/Reserves.pm line 1576
With this patch applied the operation succeeds

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Nick Clemens 2022-04-28 10:14:54 UTC
Created attachment 134218 [details] [review]
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON

RevertWaitingStatus has already removed the itemnumber from the hold, passing $itemnumber (from scanned item) should work, as it will reattach the hold to the item

Test plan:
1 - Enable HoldsAutoFill
2 - Place a title level hold
3 - Check in an item and confirm hold
4 - Switch to another branch
5 - Checkin the item
Without this patch you got
Can't call method "biblionumber" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1577.
 at /kohadevbox/koha/C4/Reserves.pm line 1576
With this patch applied the operation succeeds

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Fridolin Somers 2022-04-28 20:51:07 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 7 Kyle M Hall 2022-05-06 17:49:45 UTC
Pushed to 21.11.x for 21.11.06
Comment 8 Victor Grousset/tuxayo 2022-06-22 23:32:48 UTC
Backported: Pushed to 21.05.x branch for 21.05.16
Comment 9 Martin Renvoize 2022-06-23 13:37:52 UTC
Bugfix, no workflow of visual changes.. No documentation updates required.