From ad64661377c9cb3016b865b84e0a359ade52953e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 9 May 2018 14:30:13 -0300 Subject: [PATCH] Bug 20724: Try to fix ReservesNeedReturns wrong behaviour We need to call Koha::Hold->set_waiting to correctly calculate the expiration date. It fixes a regression introduced by commit 26634151dbce0bf39ff6c9eda5b58bb993996a2d Bug 12063 - Fix QA failures The expiration date has to be set for waiting holds TODO: same fix has to be provided for the OPAC side TODO LATER: We certainly should move code from controllers to Koha::Hold --- reserve/placerequest.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 3c55656380..5ff3b11cbd 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -107,14 +107,16 @@ if ( $type eq 'str8' && $borrower ) { if ($multi_hold) { my $bibinfo = $bibinfos{$biblionumber}; - AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,[$biblionumber], + my $hold_id = AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,[$biblionumber], $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found); + Koha::Holds->find( $hold_id )->set_waiting if $found eq 'W'; } else { # place a request on 1st available for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) { - AddReserve( $branch, $borrower->{'borrowernumber'}, + my $hold_id = AddReserve( $branch, $borrower->{'borrowernumber'}, $biblionumber, \@realbi, $rank[0], $startdate, $expirationdate, $notes, $title, $checkitem, $found, $itemtype ); + Koha::Holds->find( $hold_id )->set_waiting if $found eq 'W'; } } } -- 2.11.0