From 34572e0c8020d7b985aa553e1af540c7916e4c6b Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 30 Sep 2018 19:06:43 +0000 Subject: [PATCH] Bug 8367: reserves.lastpickupdate calculation checks and uses ExcludeHolidaysFromMaxPickUpDelay syspref Sponsored-By: Brimbank Library, Australia --- C4/Reserves.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 93ee597..12295f0 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -777,6 +777,7 @@ sub GetLastPickupDate { } else { $reservebranch = $reserve->branchcode; } + if ( defined($issuingrule) && defined $issuingrule->holdspickupwait && $issuingrule->holdspickupwait > 0 ) { #If holdspickupwait is <= 0, it means this feature is disabled for this type of material. $date->add( days => $issuingrule->holdspickupwait ); my $calendar = Koha::Calendar->new( branchcode => $reservebranch ); @@ -785,6 +786,11 @@ sub GetLastPickupDate { $date->add( days => 1 ); $is_holiday = $calendar->is_holiday( $date ); } + + if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { + $date = $calendar->days_forward( dt_from_string(), $issuingrule->holdspickupwait ); + } + $reserve->{lastpickupdate} = $date->ymd(); return $date; } -- 2.1.4