From 304dd2b0512eb82962e0425d8183b15785252913 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 23 Oct 2015 08:47:58 +0200 Subject: [PATCH] Bug 14918: [QA Follow-up] Correct enddate and use constant Corrected enddate (subtraction in the revised code must be an addition). Replaced hardcoded 2 days by a constant. Renamed the constant TWO_DAYS to PULL_INTERVAL. Signed-off-by: Marcel de Rooy Tested all three date formats. Signed-off-by: Tomas Cohen Arazi --- circ/pendingreserves.pl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index fc2df04686..4d6ec051bd 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl - # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -26,7 +25,7 @@ use strict; #use warnings; FIXME - Bug 2505 -use constant TWO_DAYS => 2; +use constant PULL_INTERVAL => 2; use C4::Context; use C4::Output; @@ -79,7 +78,7 @@ if ( $startdate ) { unless ( $startdate ){ # changed from delivered range of 10 years-yesterday to 2 days ago-today # Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set. - $startdate = $today - DateTime::Duration->new( days => C4::Context->preference('HoldsToPullStartDate') || 2 ); + $startdate = $today - DateTime::Duration->new( days => C4::Context->preference('HoldsToPullStartDate') || PULL_INTERVAL ); } if ( $enddate ) { @@ -87,7 +86,7 @@ if ( $enddate ) { } unless ( $enddate ) { #similarly: calculate end date with ConfirmFutureHolds (days) - $enddate = $today - DateTime::Duration->new( days => C4::Context->preference('ConfirmFutureHolds') || 0 ); + $enddate = $today + DateTime::Duration->new( days => C4::Context->preference('ConfirmFutureHolds') || 0 ); } my @reservedata; @@ -206,8 +205,8 @@ $template->param( run_report => $run_report, reserveloop => \@reservedata, "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, - HoldsToPullStartDate=> C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS, - HoldsToPullEndDate => C4::Context->preference('ConfirmFutureHolds')||0, + HoldsToPullStartDate => C4::Context->preference('HoldsToPullStartDate') || PULL_INTERVAL, + HoldsToPullEndDate => C4::Context->preference('ConfirmFutureHolds') || 0, ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5