X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=overdue.pl;h=02cb2dfc65c386858fd8169dcfc1f34a633dad30;hb=e339f5d64ba06180925f551da12fd5a8cdffd444;hp=d736f4d152ef3e407d67c7e92046d4bb6097b2af;hpb=0379fec072d796307f30b94111e407abf4152497;p=koha_fer diff --git a/overdue.pl b/overdue.pl index d736f4d152..02cb2dfc65 100755 --- a/overdue.pl +++ b/overdue.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl +# $Id$ # Copyright 2000-2002 Katipo Communications # @@ -19,18 +20,23 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Context; use C4::Output; use CGI; -use C4::Database; use HTML::Template; my $input = new CGI; my $type=$input->param('type'); my $theme = $input->param('theme'); # only used if allowthemeoverride is set -my %tmpldata = pathtotemplate ( template => 'overdue.tmpl', theme => $theme); -my $template = HTML::Template->new( filename => $tmpldata{'path'}, - die_on_bad_params => 0); +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "overdue.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); my $duedate; my $bornum; my $itemnum; @@ -46,7 +52,7 @@ my $author; my @datearr = localtime(time()); my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]); -my $dbh=C4Connect; +my $dbh = C4::Context->dbh; my $query="select date_due,borrowernumber,itemnumber from issues where isnull(returndate) && date_due<'$todaysdate' order by date_due,borrowernumber"; my $sth=$dbh->prepare($query); @@ -57,7 +63,7 @@ while (my $data=$sth->fetchrow_hashref) { $duedate=$data->{'date_due'}; $bornum=$data->{'borrowernumber'}; $itemnum=$data->{'itemnumber'}; - + my $query="select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber='$bornum'"; my $sth1=$dbh->prepare($query); $sth1->execute; @@ -67,6 +73,7 @@ while (my $data=$sth->fetchrow_hashref) { $email=$data1->{'emailaddress'}; $sth1->finish; + # FIXME - There's already a $query in this scope. my $query="select biblionumber from items where itemnumber='$itemnum'"; my $sth2=$dbh->prepare($query); $sth2->execute; @@ -74,6 +81,7 @@ while (my $data=$sth->fetchrow_hashref) { $biblionumber=$data2->{'biblionumber'}; $sth2->finish; + # FIXME - There's already a $query in this scope. my $query="select title,author from biblio where biblionumber='$biblionumber'"; my $sth3=$dbh->prepare($query); $sth3->execute; @@ -94,11 +102,10 @@ while (my $data=$sth->fetchrow_hashref) { } $sth->finish; -$dbh->disconnect; $template->param( startmenureport => join ('', startmenu('report')), endmenureport => join ('', endmenu('report')), todaysdate => $todaysdate, overdueloop => \@overduedata ); - + print "Content-Type: text/html\n\n", $template->output;