From 3dd421ae8b32b22b9d2a138aa1925ba7ddf0fe82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Tue, 29 Sep 2015 14:22:33 +0200 Subject: [PATCH] Bug 14920 - Remove C4::Dates from circ/reserveratios.pl This patch removes C4::Dates from circ/reserveratios.pl To test: - Make sure you have many holds for biblios with not so much items (e.g. 5 holds, 1 item) or follow hint below - Go to Home > Circulation > Hold ratios - Verify that everything works the same without an dwith patch Hint: To get a big table you can set 'Hod ratio' in the filter to 0.1 (default value is 3). This was will trigger biblios with less holds than items. --- circ/reserveratios.pl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 9675674..7ed2eca 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -27,10 +27,10 @@ use Date::Calc qw/Today Add_Delta_YM/; use C4::Context; use C4::Output; use C4::Auth; -use C4::Dates qw/format_date format_date_in_iso/; use C4::Debug; use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; use C4::Acquisition qw/GetOrdersByBiblionumber/; +use Koha::DateUtils; my $input = new CGI; my $startdate = $input->param('from'); @@ -64,10 +64,10 @@ my $datelastyear = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YM($year, $month, # Predefine the start and end dates if they are not already defined # Check if null, should string match, if so set start and end date to yesterday if (!defined($startdate) or $startdate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint - $startdate = format_date($datelastyear); + $startdate = output_pref({ dt => dt_from_string( $datelastyear ), dateonly => 1 }); } if (!defined($enddate) or $enddate !~ s/^\s*(\S+)\s*$/$1/) { # strip spaces, remove Taint - $enddate = format_date($todaysdate); + $enddate = output_pref({ dt => dt_from_string( $todaysdate ), dateonly => 1 }); } if (!defined($ratio)) { $ratio = 3; @@ -80,15 +80,15 @@ if ($ratio <= 0) { my $dbh = C4::Context->dbh; my $sqldatewhere = ""; -$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate); +$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 }); my @query_params = (); if ($startdate) { $sqldatewhere .= " AND reservedate >= ?"; - push @query_params, format_date_in_iso($startdate); + push @query_params, output_pref({ dt => dt_from_string( $startdate ), dateformat => 'iso', dateonly => 1 }); } if ($enddate) { $sqldatewhere .= " AND reservedate <= ?"; - push @query_params, format_date_in_iso($enddate); + push @query_params, output_pref({ dt => dt_from_string( $enddate ), dateformat => 'iso', dateonly => 1 }); } my $nfl_comparison = $include_ordered ? '<=' : '='; @@ -146,7 +146,7 @@ while ( my $data = $sth->fetchrow_hashref ) { push( @reservedata, { - reservedate => format_date( $data->{reservedate} ), + reservedate => output_pref({ dt => dt_from_string( $data->{reservedate} ), dateonly => 1 }), priority => $data->{priority}, name => $data->{borrower}, title => $data->{title}, @@ -178,7 +178,7 @@ for my $rd ( @reservedata ) { $template->param( ratio_atleast1 => $ratio_atleast1, - todaysdate => format_date($todaysdate), + todaysdate => output_pref({ dt => dt_from_string( $todaysdate ), dateonly => 1 }), from => $startdate, to => $enddate, ratio => $ratio, -- 1.7.10.4