Lines 27-36
use Date::Calc qw/Today Add_Delta_YM/;
Link Here
|
27 |
use C4::Context; |
27 |
use C4::Context; |
28 |
use C4::Output; |
28 |
use C4::Output; |
29 |
use C4::Auth; |
29 |
use C4::Auth; |
30 |
use C4::Dates qw/format_date format_date_in_iso/; |
|
|
31 |
use C4::Debug; |
30 |
use C4::Debug; |
32 |
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; |
31 |
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; |
33 |
use C4::Acquisition qw/GetOrdersByBiblionumber/; |
32 |
use C4::Acquisition qw/GetOrdersByBiblionumber/; |
|
|
33 |
use Koha::DateUtils; |
34 |
|
34 |
|
35 |
my $input = new CGI; |
35 |
my $input = new CGI; |
36 |
my $startdate = $input->param('from'); |
36 |
my $startdate = $input->param('from'); |
Lines 64-73
my $datelastyear = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YM($year, $month,
Link Here
|
64 |
# Predefine the start and end dates if they are not already defined |
64 |
# Predefine the start and end dates if they are not already defined |
65 |
# Check if null, should string match, if so set start and end date to yesterday |
65 |
# Check if null, should string match, if so set start and end date to yesterday |
66 |
if (!defined($startdate) or $startdate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint |
66 |
if (!defined($startdate) or $startdate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint |
67 |
$startdate = format_date($datelastyear); |
67 |
$startdate = output_pref({ dt => dt_from_string( $datelastyear ), dateonly => 1 }); |
68 |
} |
68 |
} |
69 |
if (!defined($enddate) or $enddate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint |
69 |
if (!defined($enddate) or $enddate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint |
70 |
$enddate = format_date($todaysdate); |
70 |
$enddate = output_pref({ dt => dt_from_string( $todaysdate ), dateonly => 1 }); |
71 |
} |
71 |
} |
72 |
if (!defined($ratio)) { |
72 |
if (!defined($ratio)) { |
73 |
$ratio = 3; |
73 |
$ratio = 3; |
Lines 80-94
if ($ratio <= 0) {
Link Here
|
80 |
|
80 |
|
81 |
my $dbh = C4::Context->dbh; |
81 |
my $dbh = C4::Context->dbh; |
82 |
my $sqldatewhere = ""; |
82 |
my $sqldatewhere = ""; |
83 |
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate); |
83 |
$debug and warn output_pref({ dt => dt_from_string( $startdate ), dateformat => 'iso', dateonly => 1 }) . "\n" . output_pref({ dt => dt_from_string( $enddate ), dateformat => 'iso', dateonly => 1 }); |
84 |
my @query_params = (); |
84 |
my @query_params = (); |
85 |
if ($startdate) { |
85 |
if ($startdate) { |
86 |
$sqldatewhere .= " AND reservedate >= ?"; |
86 |
$sqldatewhere .= " AND reservedate >= ?"; |
87 |
push @query_params, format_date_in_iso($startdate); |
87 |
push @query_params, output_pref({ dt => dt_from_string( $startdate ), dateformat => 'iso', dateonly => 1 }); |
88 |
} |
88 |
} |
89 |
if ($enddate) { |
89 |
if ($enddate) { |
90 |
$sqldatewhere .= " AND reservedate <= ?"; |
90 |
$sqldatewhere .= " AND reservedate <= ?"; |
91 |
push @query_params, format_date_in_iso($enddate); |
91 |
push @query_params, output_pref({ dt => dt_from_string( $enddate ), dateformat => 'iso', dateonly => 1 }); |
92 |
} |
92 |
} |
93 |
|
93 |
|
94 |
my $nfl_comparison = $include_ordered ? '<=' : '='; |
94 |
my $nfl_comparison = $include_ordered ? '<=' : '='; |
Lines 146-152
while ( my $data = $sth->fetchrow_hashref ) {
Link Here
|
146 |
push( |
146 |
push( |
147 |
@reservedata, |
147 |
@reservedata, |
148 |
{ |
148 |
{ |
149 |
reservedate => format_date( $data->{reservedate} ), |
149 |
reservedate => output_pref({ dt => dt_from_string( $data->{reservedate} ), dateonly => 1 }), |
150 |
priority => $data->{priority}, |
150 |
priority => $data->{priority}, |
151 |
name => $data->{borrower}, |
151 |
name => $data->{borrower}, |
152 |
title => $data->{title}, |
152 |
title => $data->{title}, |
Lines 178-184
for my $rd ( @reservedata ) {
Link Here
|
178 |
|
178 |
|
179 |
$template->param( |
179 |
$template->param( |
180 |
ratio_atleast1 => $ratio_atleast1, |
180 |
ratio_atleast1 => $ratio_atleast1, |
181 |
todaysdate => format_date($todaysdate), |
181 |
todaysdate => output_pref({ dt => dt_from_string( $todaysdate ), dateonly => 1 }), |
182 |
from => $startdate, |
182 |
from => $startdate, |
183 |
to => $enddate, |
183 |
to => $enddate, |
184 |
ratio => $ratio, |
184 |
ratio => $ratio, |
185 |
- |
|
|