From aebe348e7e1a265561d5e19c97c7617d9e2e1368 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 17 Dec 2025 14:22:44 +0000 Subject: [PATCH] Bug 40771: Fix error in the case of AutoFill Similar to previous patches we need to ignore limits to return a reserve where it belongs To test: 1 - Set sysprefs: UseBranchTransferLimits/BranchTransferLimitsType: To Enforce based on collection HoldsAutoFill: Do 2 - Administration->Library Transfer limits click (Advanced editor) 3 - Uncheck Centerville->Fairfield for 'Fiction' 4 - Find or create a Fiction item at centerville 5 - Place a hold on the item for a patron to pickup at Centerville 6 - Check the item in at Centerville 7 - Switch branch to Fairfield 8 - Check in the item 9 - Boom! Exception 'Koha::Exceptions::Item::Transfer::Limit' thrown 'Transfer not allowed' 10 - Apply patch, restart all 11 - Check in the item at Fairfield 12 - Correctly transferred to Centerville Signed-off-by: Nick Clemens --- circ/returns.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/circ/returns.pl b/circ/returns.pl index 35c3367ea4b..5fa96697acf 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -610,7 +610,9 @@ if ( $messages->{'ResFound'} ) { my $tobranch = Koha::Libraries->find( $reserve->{branchcode} ); # Add transfer, enqueue if one is already in the queue, and immediately set to in transit - my $transfer = $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1 } ); + # we have to ignore limits here so the reserve can get where it belongs if it ended up here wrongly + my $transfer = + $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1, ignore_limits => 1 } ); $transfer->transit; } -- 2.39.5