Lines 27-41
use strict;
Link Here
|
27 |
#use warnings; FIXME - Bug 2505 |
27 |
#use warnings; FIXME - Bug 2505 |
28 |
|
28 |
|
29 |
use constant TWO_DAYS => 2; |
29 |
use constant TWO_DAYS => 2; |
30 |
use constant TWO_DAYS_AGO => -2; |
|
|
31 |
|
30 |
|
32 |
use C4::Context; |
31 |
use C4::Context; |
33 |
use C4::Output; |
32 |
use C4::Output; |
34 |
use CGI qw ( -utf8 ); |
33 |
use CGI qw ( -utf8 ); |
35 |
use C4::Auth; |
34 |
use C4::Auth; |
36 |
use C4::Dates qw/format_date format_date_in_iso/; |
|
|
37 |
use C4::Debug; |
35 |
use C4::Debug; |
38 |
use Date::Calc qw/Today Add_Delta_YMD/; |
36 |
use Koha::DateUtils; |
|
|
37 |
use DateTime::Duration; |
39 |
|
38 |
|
40 |
my $input = new CGI; |
39 |
my $input = new CGI; |
41 |
my $startdate=$input->param('from'); |
40 |
my $startdate=$input->param('from'); |
Lines 68-106
my $biblionumber;
Link Here
|
68 |
my $title; |
67 |
my $title; |
69 |
my $author; |
68 |
my $author; |
70 |
|
69 |
|
71 |
my ( $year, $month, $day ) = Today(); |
70 |
my $today = dt_from_string; |
72 |
my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day); |
|
|
73 |
$startdate =~ s/^\s+//; |
71 |
$startdate =~ s/^\s+//; |
74 |
$startdate =~ s/\s+$//; |
72 |
$startdate =~ s/\s+$//; |
75 |
$enddate =~ s/^\s+//; |
73 |
$enddate =~ s/^\s+//; |
76 |
$enddate =~ s/\s+$//; |
74 |
$enddate =~ s/\s+$//; |
77 |
|
75 |
|
78 |
if (!defined($startdate) or $startdate eq "") { |
76 |
if ( $startdate ) { |
|
|
77 |
$startdate = eval{dt_from_string( $startdate )}; |
78 |
} |
79 |
unless ( $startdate ){ |
79 |
# changed from delivered range of 10 years-yesterday to 2 days ago-today |
80 |
# changed from delivered range of 10 years-yesterday to 2 days ago-today |
80 |
# Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set. |
81 |
# Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set. |
81 |
my $pastdate= sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS_AGO )); |
82 |
$startdate = $today - DateTime::Duration->new( days => C4::Context->preference('HoldsToPullStartDate') || 2 ); |
82 |
$startdate = format_date($pastdate); |
|
|
83 |
} |
83 |
} |
84 |
|
84 |
|
85 |
if (!defined($enddate) or $enddate eq "") { |
85 |
if ( $enddate ) { |
|
|
86 |
$enddate = eval{dt_from_string( $enddate )}; |
87 |
} |
88 |
unless ( $enddate ) { |
86 |
#similarly: calculate end date with ConfirmFutureHolds (days) |
89 |
#similarly: calculate end date with ConfirmFutureHolds (days) |
87 |
my $d=sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, C4::Context->preference('ConfirmFutureHolds')||0 )); |
90 |
$enddate = $today - DateTime::Duration->new( days => C4::Context->preference('ConfirmFutureHolds') || 0 ); |
88 |
$enddate = format_date($d); |
|
|
89 |
} |
91 |
} |
90 |
|
92 |
|
91 |
my @reservedata; |
93 |
my @reservedata; |
92 |
if ( $run_report ) { |
94 |
if ( $run_report ) { |
93 |
my $dbh = C4::Context->dbh; |
95 |
my $dbh = C4::Context->dbh; |
94 |
my $sqldatewhere = ""; |
96 |
my $sqldatewhere = ""; |
95 |
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate); |
97 |
my $startdate_iso = output_pref({ dt => $startdate, dateformat => 'iso', dateonly => 1 }); |
|
|
98 |
my $enddate_iso = output_pref({ dt => $enddate, dateformat => 'iso', dateonly => 1 }); |
99 |
$debug and warn $startdate_iso. "\n" . $enddate_iso; |
96 |
my @query_params = (); |
100 |
my @query_params = (); |
97 |
if ($startdate) { |
101 |
if ($startdate_iso) { |
98 |
$sqldatewhere .= " AND reservedate >= ?"; |
102 |
$sqldatewhere .= " AND reservedate >= ?"; |
99 |
push @query_params, format_date_in_iso($startdate); |
103 |
push @query_params, $startdate_iso; |
100 |
} |
104 |
} |
101 |
if ($enddate) { |
105 |
if ($enddate_iso) { |
102 |
$sqldatewhere .= " AND reservedate <= ?"; |
106 |
$sqldatewhere .= " AND reservedate <= ?"; |
103 |
push @query_params, format_date_in_iso($enddate); |
107 |
push @query_params, $enddate_iso; |
104 |
} |
108 |
} |
105 |
|
109 |
|
106 |
my $strsth = |
110 |
my $strsth = |
Lines 196-202
if ( $run_report ) {
Link Here
|
196 |
} |
200 |
} |
197 |
|
201 |
|
198 |
$template->param( |
202 |
$template->param( |
199 |
todaysdate => $todaysdate, |
203 |
todaysdate => $today, |
200 |
from => $startdate, |
204 |
from => $startdate, |
201 |
to => $enddate, |
205 |
to => $enddate, |
202 |
run_report => $run_report, |
206 |
run_report => $run_report, |