From cfbf9b07ae48915ad76857d36e12055dd3e3ad34 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 15 Aug 2024 15:04:44 +0200 Subject: [PATCH] Bug 37650: Add lookahead in calling GetOtherReserves in returns.pl Content-Type: text/plain; charset=utf-8 Test plan: Add a future hold for an item on another branch. Check that item in at the home branch. Without this patch, you can confirm the hold but a transfer will not be made. With this patch, the transfer should be created. --- C4/Reserves.pm | 6 +++--- circ/returns.pl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 5056c5b51b..f1780c828c 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -666,17 +666,17 @@ sub CanReserveBeCanceledFromOpac { =head2 GetOtherReserves - ($messages,$nextreservinfo)=$GetOtherReserves(itemnumber); + ( $messages, $nextreservinfo) = GetOtherReserves( $itemnumber, $lookahead_days ); Check queued list of this document and check if this document must be transferred =cut sub GetOtherReserves { - my ($itemnumber) = @_; + my ( $itemnumber, $lookahead_days ) = @_; my $messages; my $nextreservinfo; - my ( undef, $checkreserves, undef ) = CheckReserves($itemnumber); + my ( undef, $checkreserves, undef ) = CheckReserves( $itemnumber, undef, $lookahead_days ); if ($checkreserves) { my $item = Koha::Items->find($itemnumber); if ( $item->holdingbranch ne $checkreserves->{'branchcode'} ) { diff --git a/circ/returns.pl b/circ/returns.pl index 3a3ec6322a..4666575074 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -163,7 +163,7 @@ if ( $query->param('reserve_id') ) { ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id ); } # check if we have other reserves for this document, if we have a return send the message of transfer - my ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber); + my ( $messages, $nextreservinfo ) = GetOtherReserves( $itemnumber, C4::Context->preference('ConfirmFutureHolds') ); my $patron = Koha::Patrons->find( $nextreservinfo ); if ( $messages->{'transfert'} ) { @@ -574,7 +574,7 @@ if ( $messages->{'ResFound'} ) { my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef; ModReserveAffect( $itemnumber, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id}, $desk_id ); - my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber}); + my ( $messages, $nextreservinfo ) = GetOtherReserves( $reserve->{itemnumber}, C4::Context->preference('ConfirmFutureHolds') ); $template->param( hold_auto_filled => 1, -- 2.30.2