use C4::Auth;
use C4::Branch;
use C4::Dates qw/format_date/;
+use Date::Calc qw/Today/;
my $input = new CGI;
my $type = $input->param('type');
# download the complete CSV
if ($op eq 'csv') {
warn "BRANCH : $branchfilter";
- my $csv = `../misc/cronjobs/overduenotices-csv.pl -c -n -b $branchfilter`;
+ my $lib = $branchfilter ? "-library $branchfilter" :'';
+ my $csv = `../misc/cronjobs/overdue_notices.pl -csv -n $lib`;
print $input->header(-type => 'application/vnd.sun.xml.calc',
-encoding => 'utf-8',
-attachment=>"overdues.csv",
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
-my @selectflags;
-push @selectflags, " ";#
-push @selectflags,"gonenoaddress";#
-push @selectflags,"debarred";#
-push @selectflags,"lost";#
-my $CGIflags=CGI::scrolling_list( -name => 'borflags',
- -id =>'borflags',
- -values => \@selectflags,
- -size => 1,
- -multiple => 0 );
foreach my $thisbranch ( sort keys %$branches ) {
my %row = (
$template->param(borcatloop=> \@borcatloop,
itemtypeloop => \@itemtypeloop,
branchloop=> \@branchloop,
- CGIflags => $CGIflags,
borname => $bornamefilter,
order => $order,
showall => $showall);
my $email;
my $title;
my $author;
-my @datearr = localtime( time() );
-my $todaysdate =
- ( 1900 + $datearr[5] ) . '-'
- . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
- . sprintf( "%0.2d", $datearr[3] );
+my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Today());
$bornamefilter =~s/\*/\%/g;
$bornamefilter =~s/\?/\_/g;
LEFT JOIN items ON (issues.itemnumber=items.itemnumber)
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
LEFT JOIN biblio ON (biblio.biblionumber=items.biblionumber )
-WHERE isnull(returndate) ";
+WHERE 1=1 "; # placeholder, since it is possible that none of the additional
+ # conditions will be selected by user
$strsth.= " && date_due<'".$todaysdate."' " unless ($showall);
$strsth.=" && (borrowers.firstname like '".$bornamefilter."%' or borrowers.surname like '".$bornamefilter."%' or borrowers.cardnumber like '".$bornamefilter."%')" if($bornamefilter) ;
$strsth.=" && borrowers.categorycode = '".$borcatfilter."' " if($borcatfilter) ;
}
$template->param(
- todaysdate => $todaysdate,
+ todaysdate => format_date($todaysdate),
overdueloop => \@overduedata
);