Bug 8585 : Add System Preference to specify Holds to Pull List Start Date
[koha.git] / circ / pendingreserves.pl
index 61bace9..a9c317d 100755 (executable)
@@ -68,8 +68,9 @@ my ( $year, $month, $day ) = Today();
 my $todaysdate     = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day);
 my $yesterdaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day,   0, 0, -1));
 # changed from delivered range of 10 years-yesterday to 2 days ago-today
-# Find two days ago for the default shelf pull start and end dates
-my $pastdate       = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -2));
+# Find two days ago for the default shelf pull start and end dates, unless HoldsToPullStartDate sys pref is set.
+my $defaultstartdate = ( C4::Context->preference('HoldsToPullStartDate') ) ? "-".C4::Context->preference('HoldsToPullStartDate') : -2;
+my $pastdate       = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, $defaultstartdate));
 
 # Predefine the start and end dates if they are not already defined
 $startdate =~ s/^\s+//;