From 82b8c496fdb642d678aed4499b2fceb739e65e64 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 4 Dec 2007 17:40:55 -0600 Subject: [PATCH] circ subdir - Dates.pm integration and warnings fixes. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- circ/bookcount.pl | 2 +- circ/branchoverdues.pl | 2 +- circ/circulation.pl | 4 ++-- circ/overdue.pl | 24 +++++++++++------------- circ/returns.pl | 2 +- circ/stats.pl | 16 ++++------------ circ/transferstodo.pl | 2 +- circ/transferstoreceive.pl | 18 +++++++----------- circ/waitingreserves.pl | 2 +- circ/ysearch.pl | 2 +- 10 files changed, 30 insertions(+), 44 deletions(-) diff --git a/circ/bookcount.pl b/circ/bookcount.pl index 6894f8bb31..48b3ae2c1b 100755 --- a/circ/bookcount.pl +++ b/circ/bookcount.pl @@ -30,7 +30,7 @@ use C4::Koha; use C4::Auth; use C4::Branch; # GetBranches use C4::Biblio; # GetBiblioItemData -use C4::Date; +use C4::Dates; my $input = new CGI; my $itm = $input->param('itm'); diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index fc146931bf..b7c4387d29 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -21,7 +21,7 @@ use C4::Context; use CGI; use C4::Output; use C4::Auth; -use C4::Date; +use C4::Dates; use C4::Overdues; # AddNotifyLine use C4::Biblio; use C4::Koha; diff --git a/circ/circulation.pl b/circ/circulation.pl index e307fdde76..d6acddb8fc 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -27,7 +27,7 @@ use CGI; use C4::Output; use C4::Print; use C4::Auth qw/:DEFAULT get_session/; -use C4::Date; +use C4::Dates; use C4::Branch; # GetBranches use C4::Koha; # GetPrinter use C4::Circulation; @@ -141,7 +141,7 @@ if($duedatespec) { # ($year, $month, $day) = ($duedatespec) ? split /-/, $duedatespec : (0,0,0); #} -my @datearr = localtime( time() ); +my @datearr = localtime(); # FIXME - Could just use POSIX::strftime("%Y%m%d", localtime); my $todaysdate = diff --git a/circ/overdue.pl b/circ/overdue.pl index 760ba7ce86..7be383013a 100755 --- a/circ/overdue.pl +++ b/circ/overdue.pl @@ -24,21 +24,19 @@ use C4::Output; use CGI; use C4::Auth; use C4::Branch; -use C4::Date; +use C4::Dates; my $input = new CGI; -my $type = $input->param('type'); - -my $theme = $input->param('theme'); # only used if allowthemeoverride is set -my $order=$input->param('order'); -my $bornamefilter=$input->param('borname'); -my $borcatfilter=$input->param('borcat'); -my $itemtypefilter=$input->param('itemtype'); -my $borflagsfilter=$input->param('borflags') || " "; -my $branchfilter=$input->param('branch'); -my $showall=$input->param('showall'); -my $theme = $input->param('theme'); # only used if allowthemeoverride is set - +my $type = $input->param('type'); +my $theme = $input->param('theme'); # only used if allowthemeoverride is set +my $order = $input->param('order'); +my $showall = $input->param('showall'); + +my $bornamefilter = $input->param('borname'); +my $borcatfilter = $input->param('borcat'); +my $itemtypefilter = $input->param('itemtype'); +my $borflagsfilter = $input->param('borflags') || " "; +my $branchfilter = $input->param('branch'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { diff --git a/circ/returns.pl b/circ/returns.pl index 3a60c3472e..e37c97a355 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -31,7 +31,7 @@ use C4::Context; use C4::Auth; use C4::Output; use C4::Circulation; -use C4::Date; +use C4::Dates; use C4::Print; use C4::Reserves; use C4::Biblio; diff --git a/circ/stats.pl b/circ/stats.pl index 5c1248b2af..23841ba9d6 100755 --- a/circ/stats.pl +++ b/circ/stats.pl @@ -78,8 +78,8 @@ warn "d : $date // d2 : $date2"; my @payments = TotalPaid( $date, $date2 ); my $count = @payments; my $total = 0; +my $totalw = 0; my $oldtime; -my $totalw = 0; my @loop; my %row; my $i = 0; @@ -136,11 +136,7 @@ while ( $i < $count ) { } } } - my $hour = substr( $payments[$i]{'timestamp'}, 8, 2 ); - my $min = substr( $payments[$i]{'timestamp'}, 10, 2 ); - my $sec = substr( $payments[$i]{'timestamp'}, 12, 2 ); - my $time = "$hour:$min:$sec"; - my $time2 = "$payments[$i]{'date'}"; + my $time2 = $payments[$i]{'date'}; my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} ); my $borrowernumber = $payments[$i]{'borrowernumber'}; my $oldtime = $payments[$i]{'timestamp'}; @@ -150,12 +146,8 @@ while ( $i < $count ) { && $oldtype == $payments[$i]{'accounttype'} && $oldtime eq $payments[$i]{'timestamp'} ) { - my $hour = substr( $payments[$i]{'timestamp'}, 8, 2 ); - my $min = substr( $payments[$i]{'timestamp'}, 10, 2 ); - my $sec = substr( $payments[$i]{'timestamp'}, 12, 2 ); - my $time = "$hour:$min:$sec"; - my $time2 = "$payments[$i]{'date'}"; - my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} ); + my $xtime2 = $payments[$i]{'date'}; + my $branch = Getpaidbranch( $xtime2, $payments[$i]{'borrowernumber'} ); if ( $payments[$i]{'accounttype'} eq 'W' ) { $totalw += $payments[$i]{'amount'}; } diff --git a/circ/transferstodo.pl b/circ/transferstodo.pl index ff00c88f3e..fd5e2da3e3 100755 --- a/circ/transferstodo.pl +++ b/circ/transferstodo.pl @@ -24,7 +24,7 @@ use C4::Output; use CGI; use C4::Branch; # GetBranches use C4::Auth; -use C4::Date; +use C4::Dates; use C4::Circulation; use C4::Reserves; use C4::Members; diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 697a41a71c..8f652608b3 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -24,7 +24,7 @@ use C4::Context; use C4::Output; use C4::Branch; use C4::Auth; -use C4::Date; +use C4::Dates; use C4::Biblio; use C4::Circulation; use C4::Members; @@ -41,7 +41,7 @@ my $input = new CGI; my $theme = $input->param('theme'); # only used if allowthemeoverride is set my $itemnumber = $input->param('itemnumber'); -my $todaysdate = join "-", &Today; + # if we have a resturn of the form to delete the transfer, we launch the subrroutine if ($itemnumber) { @@ -93,15 +93,11 @@ foreach my $br ( keys %$branches ) { my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} ); my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); - $getransf{'title'} = $gettitle->{'title'}; $getransf{'datetransfer'} = format_date( $num->{'datesent'} ); - $getransf{'biblionumber'} = $gettitle->{'biblionumber'}; - $getransf{'itemnumber'} = $gettitle->{'itemnumber'}; - $getransf{'barcode'} = $gettitle->{'barcode'}; - $getransf{'itemtype'} = $itemtypeinfo->{'description'}; - $getransf{'homebranch'} = $gettitle->{'homebranch'}; - $getransf{'holdingbranch'} = $gettitle->{'holdingbranch'}; - $getransf{'itemcallnumber'} = $gettitle->{'itemcallnumber'}; + $getransf{'itemtype'} = $itemtypeinfo->{'description'}; + foreach (qw(title biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) { + $getransf{$_} = $gettitle->{$_}; + } # we check if we have a reserv for this transfer my @checkreserv = GetReservesFromItemnumber($num->{'itemnumber'} ); @@ -128,7 +124,7 @@ foreach my $br ( keys %$branches ) { $template->param( branchesloop => \@branchesloop, - show_date => format_date($todaysdate), + show_date => format_date(join("-", &Today)), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index a802e957f7..692c38a444 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -24,7 +24,7 @@ use C4::Context; use C4::Output; use C4::Branch; # GetBranchName use C4::Auth; -use C4::Date; +use C4::Dates; use C4::Circulation; use C4::Members; use C4::Biblio; diff --git a/circ/ysearch.pl b/circ/ysearch.pl index 9b42a57289..e3bc26798a 100755 --- a/circ/ysearch.pl +++ b/circ/ysearch.pl @@ -35,7 +35,7 @@ my $query = $input->param('query'); print $input->header(-type => 'text/plain', -charset => 'ISO-8859-1'); my $dbh = C4::Context->dbh; -my $query = "SELECT surname, firstname, cardnumber, address, city, zipcode ". +$query = "SELECT surname, firstname, cardnumber, address, city, zipcode ". "FROM borrowers " . "WHERE surname LIKE '". $query . "%' " . "OR firstname LIKE '" . $query . "%' " . -- 2.20.1