From d200b1368d6eacc9709f654b424b75d5c47100b5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 21 Oct 2024 12:42:06 +0100 Subject: [PATCH] Bug 35721: Replace newly introduced ModItemTransfer calls Content-Type: text/plain; charset=utf-8 Signed-off-by: Phil Ringnalda Signed-off-by: Marcel de Rooy --- circ/returns.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 65169d42f0..8a21788954 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -170,8 +170,13 @@ if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve') { # i.e., whether to apply waiting status ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id ); + my $hold = Koha::Holds->find($reserve_id); if ($diffBranchSend) { - ModItemTransfer( $itemnumber, $userenv_branch, $diffBranchSend, 'Reserve' ); + my $tobranch = Koha::Libraries->find( $hold->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 } ); + $transfer->transit; } } # check if we have other reserves for this document, if we have a result send the message of transfer @@ -612,7 +617,10 @@ if ( $messages->{'ResFound'} ) { ModReserveAffect( $itemnumber, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id}, $desk_id ); if ($diffBranchSend) { - ModItemTransfer( $itemnumber, $item->holdingbranch, $reserve->{branchcode}, 'Reserve' ); + 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 } ); + $transfer->transit; } $template->param( -- 2.39.5