Browse Source

fix errors with using today's date and format_date

This patch should reduce the occurrence of the following
message in the error log:

Illegal Date '2008-3-14' does not match 'iso' format: yyyy-mm-dd

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Galen Charlton 16 years ago
committed by Joshua Ferraro
parent
commit
a9f7993b3e
  1. 7
      circ/branchoverdues.pl
  2. 8
      circ/transferstodo.pl
  3. 2
      circ/transferstoreceive.pl
  4. 8
      circ/waitingreserves.pl
  5. 8
      members/memberentry.pl
  6. 4
      reserve/request.pl
  7. 8
      tools/cleanborrowers.pl

7
circ/branchoverdues.pl

@ -26,7 +26,6 @@ use C4::Overdues; # AddNotifyLine
use C4::Biblio;
use C4::Koha;
use C4::Debug;
use Date::Calc qw/Today Today_and_Now Now/;
=head1 branchoverdues.pl
@ -71,10 +70,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $default = C4::Context->userenv->{'branch'};
# Initate localtime
my ( $year, $month, $day ) = &Today;
my $todaysdate = join "-", ( $year, $month, $day );
# Deal with the vars recept from the template
my $borrowernumber = $input->param('borrowernumber');
my $itemnumber = $input->param('itemnumber');
@ -149,7 +144,7 @@ foreach my $num (@getoverdues) {
# initiate the templates for the overdueloop
$template->param(
overduesloop => \@overduesloop,
show_date => format_date($todaysdate),
show_date => format_date(C4::Dates->today('iso')),
location => $location,
);

8
circ/transferstodo.pl

@ -53,12 +53,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
# set the userenv branch
my $default = C4::Context->userenv->{'branch'};
my @datearr = localtime( time() );
my $todaysdate =
( 1900 + $datearr[5] ) . '-'
. sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
. sprintf( "%0.2d", $datearr[3] );
my $item = $input->param('itemnumber');
my $fbr = $input->param('fbr');
my $tbr = $input->param('tbr');
@ -134,7 +128,7 @@ foreach my $br ( keys %$branches ) {
$template->param(
branchesloop => \@branchesloop,
show_date => format_date($todaysdate)
show_date => format_date(C4::Dates->today('iso')),
);
output_html_with_http_headers $input, $cookie, $template->output;

2
circ/transferstoreceive.pl

@ -124,7 +124,7 @@ foreach my $br ( keys %$branches ) {
$template->param(
branchesloop => \@branchesloop,
show_date => format_date(join("-", &Today)),
show_date => format_date(C4::Dates->today('iso')),
);
output_html_with_http_headers $input, $cookie, $template->output;

8
circ/waitingreserves.pl

@ -62,12 +62,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $default = C4::Context->userenv->{'branch'};
my @datearr = localtime( time() );
my $todaysdate =
( 1900 + $datearr[5] ) . '-'
. sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
. sprintf( "%0.2d", $datearr[3] );
# if we have a return from the form we launch the subroutine CancelReserve
if ($item) {
my $messages;
@ -164,7 +158,7 @@ foreach my $num (@getreserves) {
$template->param(
reserveloop => \@reservloop,
show_date => format_date($todaysdate),
show_date => format_date(C4::Dates->today('iso')),
);
output_html_with_http_headers $input, $cookie, $template->output;

8
members/memberentry.pl

@ -21,7 +21,6 @@
use strict;
# external modules
use Date::Calc qw/Today/;
use CGI;
# use Digest::MD5 qw(md5_base64);
@ -212,7 +211,7 @@ if ($op eq 'save' || $op eq 'insert'){
if ($op eq 'modify' || $op eq 'insert'){
unless ($newdata{'dateexpiry'}){
my $arg2 = $newdata{'dateenrolled'} || sprintf('%04d-%02d-%02d', Today());
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso');
$newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2);
}
}
@ -267,7 +266,7 @@ if (C4::Context->preference("IndependantBranches")) {
}
}
if ($op eq 'add'){
my $arg2 = $newdata{'dateenrolled'} || sprintf('%04d-%02d-%02d', Today());
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso');
$data{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2);
$template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1);
@ -472,8 +471,7 @@ if ($nok) {
#Formatting data for display
if ($data{'dateenrolled'} eq ''){
my $today = sprintf('%04d-%02d-%02d', Today()); # ISO format
$data{'dateenrolled'}=$today;
$data{'dateenrolled'}=C4::Dates->today('iso');
}
if (C4::Context->preference('uppercasesurnames')) {
$data{'surname'} =uc($data{'surname'} );

4
reserve/request.pl

@ -29,7 +29,7 @@ use strict;
use C4::Branch; # GetBranches get_branchinfos_of
use CGI;
use List::MoreUtils qw/uniq/;
use Date::Calc qw/Today Date_to_Days/;
use Date::Calc qw/Date_to_Days/;
use C4::Output;
use C4::Auth;
use C4::Reserves;
@ -70,7 +70,7 @@ my $messageborrower;
my $warnings;
my $messages;
my $date = sprintf( '%04d-%02d-%02d', Today() );
my $date = C4::Dates->today('iso');
if ($findborrower) {
my ( $count, $borrowers ) =

8
tools/cleanborrowers.pl

@ -39,7 +39,7 @@ use C4::Output;
use C4::Dates qw/format_date format_date_in_iso/;
use C4::Members; # GetBorrowersWhoHavexxxBorrowed.
use C4::Circulation; # AnonymiseIssueHistory.
use Date::Calc qw/Date_to_Days Today/;
use Date::Calc qw/Today Add_Delta_YM/;
my $cgi = new CGI;
@ -147,10 +147,8 @@ if ( $params->{'step3'} ) {
#default value set to the template are the 'CNIL' value.
my ( $year, $month, $day ) = &Today();
my $tmpyear = $year - 1;
my $tmpmonth = $month - 3;
$filterdate1 = format_date($tmpyear . "-" . $month . "-" . $day);
$filterdate2 = format_date($year . "-" . $tmpmonth . "-" . $day);
$filterdate1 = format_date(sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YM($year, $month, $day, -1, 0)));
$filterdate2 = format_date(sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YM($year, $month, $day, 0, -3)));
$template->param(
step1 => '1',

Loading…
Cancel
Save