From 16c1c24fbffd0cbf1de56f2647894c97545c07a5 Mon Sep 17 00:00:00 2001 From: szrj1m Date: Tue, 23 Aug 2005 23:56:08 +0000 Subject: [PATCH] Fixed non us date, and ?time=19/08/2005 now works. --- stats.print.pl | 10 +++++++++- stats.screen.pl | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/stats.print.pl b/stats.print.pl index 944a140787..30ab529004 100755 --- a/stats.print.pl +++ b/stats.print.pl @@ -10,6 +10,7 @@ use C4::Context; use Date::Manip; use C4::Stats; use Text::CSV_XS; +&Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005 my $csv = Text::CSV_XS->new( { @@ -50,9 +51,16 @@ if ($time=~ /\//){ $date2=DateCalc($date,$date2); } +if ($time eq ''){ + $date=ParseDate('today'); + $date2=ParseDate('tomorrow'); +} + + my $date=UnixDate($date,'%Y-%m-%d'); my $date2=UnixDate($date2,'%Y-%m-%d'); +#warn "MASON: DATE: $date, $date2"; #get a list of every payment my @payments=TotalPaid($date,$date2); @@ -133,7 +141,7 @@ $totalcredits = substr($totalcredits, 1); print $input->header( -type => 'application/vnd.ms-excel', - -attachment => "moo.csv", + -attachment => "moo.csv", ); print "Branch, Datetime, Surame, Firstnames, Description, Type, Invoice amount, Payment type, Payment Amount\n"; diff --git a/stats.screen.pl b/stats.screen.pl index ac430563f4..9ada1fed21 100755 --- a/stats.screen.pl +++ b/stats.screen.pl @@ -9,7 +9,7 @@ use C4::Interface::CGI::Output; use C4::Context; use Date::Manip; use C4::Stats; - +&Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005 my $input=new CGI; my $time=$input->param('time'); @@ -47,6 +47,13 @@ if ($time=~ /\//){ $date2=ParseDateDelta('+ 1 day'); $date2=DateCalc($date,$date2); } +# if time is blank +if ($time eq ''){ + $date=ParseDate('today'); + $date2=ParseDate('tomorrow'); +} + + my $date=UnixDate($date,'%Y-%m-%d'); my $date2=UnixDate($date2,'%Y-%m-%d'); -- 2.39.5