From e4d7a39babe902e74cd07b6cfc90e1bc5b318bbc Mon Sep 17 00:00:00 2001 From: wolfpac444 Date: Sat, 5 Apr 2003 03:19:33 +0000 Subject: [PATCH] Fixed the dates in aqbudget.pl --- C4/Date.pm | 10 ++++++++++ admin/aqbudget.pl | 20 +++++++++---------- .../default/en/parameters/aqbudget.tmpl | 4 ++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/C4/Date.pm b/C4/Date.pm index c7ddfc405e..3b8dcdcd7e 100644 --- a/C4/Date.pm +++ b/C4/Date.pm @@ -56,6 +56,11 @@ sub format_date my $olddate = shift; my $newdate; + if ( ! $olddate ) + { + return ""; + } + my $dateformat = get_date_format(); if ( $dateformat eq "us" ) @@ -86,6 +91,11 @@ sub format_date_in_iso { my $olddate = shift; my $newdate; + + if ( ! $olddate ) + { + return ""; + } my $dateformat = get_date_format(); diff --git a/admin/aqbudget.pl b/admin/aqbudget.pl index bc242d6152..820b43e17a 100755 --- a/admin/aqbudget.pl +++ b/admin/aqbudget.pl @@ -39,6 +39,7 @@ use strict; use CGI; +use C4::Date; use C4::Auth; use C4::Context; use C4::Output; @@ -46,8 +47,6 @@ use C4::Interface::CGI::Output; use C4::Search; use HTML::Template; - - sub StringSearch { my ($env,$searchstring,$type)=@_; my $dbh = C4::Context->dbh; @@ -130,8 +129,9 @@ if ($op eq 'add_form') { } else { $template->param(adding => 1); } - $template->param(startdate => $dataaqbudget->{'startdate'}); - $template->param(enddate => $dataaqbudget->{'enddate'}); + $template->param(dateformat => display_date_format() ); + $template->param(startdate => format_date($dataaqbudget->{'startdate'})); + $template->param(enddate => format_date($dataaqbudget->{'enddate'})); $template->param(budgetamount => $dataaqbudget->{'budgetamount'}); # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## @@ -140,8 +140,8 @@ if ($op eq 'add_form') { my $dbh = C4::Context->dbh; my $query = "replace aqbudget (bookfundid,startdate,enddate,budgetamount) values ("; $query.= $dbh->quote($input->param('bookfundid')).","; - $query.= $dbh->quote($input->param('startdate')).","; - $query.= $dbh->quote($input->param('enddate')).","; + $query.= $dbh->quote(format_date_in_iso($input->param('startdate'))).","; + $query.= $dbh->quote(format_date_in_iso($input->param('enddate'))).","; $query.= $dbh->quote($input->param('budgetamount')).")"; my $sth=$dbh->prepare($query); $sth->execute; @@ -160,8 +160,8 @@ if ($op eq 'add_form') { my $data=$sth->fetchrow_hashref; $sth->finish; $template->param(bookfundid => $bookfundid); - $template->param(startdate => $data->{'startdate'}); - $template->param(enddate => $data->{'enddate'}); + $template->param(startdate => format_date($data->{'startdate'})); + $template->param(enddate => format_date($data->{'enddate'})); $template->param(budgetamount => $data->{'budgetamount'}); # END $OP eq DELETE_CONFIRM ################## DELETE_CONFIRMED ################################## @@ -205,8 +205,8 @@ if ($op eq 'add_form') { push(@toggle,$toggle); push(@bookfundid,$results->[$i]{'bookfundid'}); push(@bookfundname,$dataaqbookfund->{'bookfundname'}); - push(@startdate,$results->[$i]{'startdate'}); - push(@enddate,$results->[$i]{'enddate'}); + push(@startdate,format_date($results->[$i]{'startdate'})); + push(@enddate,format_date($results->[$i]{'enddate'})); push(@budgetamount,$results->[$i]{'budgetamount'}); if ($toggle eq 'white'){ $toggle="#ffffcc"; diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl index 634582e286..faecc7f884 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl @@ -91,8 +91,8 @@ Book fund -Start date  -End date +Start date ()  +End date () Budget amount   -- 2.39.5