From rangi@users.sourceforge.net Sun Mar 18 14:04:27 2001 From: Chris Cormack To: koha-devel@lists.koha-community.org Subject: [Koha-devel] CVS: koha overdue.pl,NONE,1.1 Date: Sun, 18 Mar 2001 14:06:42 -0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4551635062911798772==" --===============4551635062911798772== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update of /cvsroot/koha/koha In directory usw-pr-cvs1:/tmp/cvs-serv29706 Added Files: overdue.pl=20 Log Message: Script to list overdue books under the headings Due-Date Patron Phone Title Author The patron can be email by clicking on the name (if the database contains an email address for them) Courtesy of Glen Stewart --- NEW FILE --- #!/usr/bin/perl use strict; use C4::Output; use CGI; use C4::Database; my $input =3D new CGI; print $input->header; my $type=3D$input->param('type'); print startpage(); print startmenu('report'); my $duedate; my $bornum; my $itemnum; my $data1; my $data2; my $data3; my $name; my $phone; my $email; my $biblionumber; my $title; my $author; my @datearr =3D localtime(time()); my $todaysdate =3D (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).= '-'.sprintf ("%0.2d", $datearr[3]); print "Items Overdue as of $todaysdate

"; print << "EOF"; EOF my $dbh=3DC4Connect; my $query=3D"select date_due,borrowernumber,itemnumber from issues where isnu= ll(returndate) && date_due<'$todaysdate' order by date_due,borrowernumber"; my $sth=3D$dbh->prepare($query); $sth->execute; while (my $data=3D$sth->fetchrow_hashref) { $duedate=3D$data->{'date_due'}; $bornum=3D$data->{'borrowernumber'}; $itemnum=3D$data->{'itemnumber'}; =20 my $query=3D"select concat(firstname,' ',surname),phone,emailaddress from b= orrowers where borrowernumber=3D'$bornum'"; my $sth1=3D$dbh->prepare($query); $sth1->execute; $data1=3D$sth1->fetchrow_hashref; $name=3D$data1->{'concat(firstname,\' \',surname)'}; $phone=3D$data1->{'phone'}; $email=3D$data1->{'emailaddress'}; $sth1->finish; my $query=3D"select biblionumber from items where itemnumber=3D'$itemnum'"; my $sth2=3D$dbh->prepare($query); $sth2->execute; $data2=3D$sth2->fetchrow_hashref; $biblionumber=3D$data2->{'biblionumber'}; $sth2->finish; my $query=3D"select title,author from biblio where biblionumber=3D'$biblion= umber'"; my $sth3=3D$dbh->prepare($query); $sth3->execute; $data3=3D$sth3->fetchrow_hashref; $title=3D$data3->{'title'}; $author=3D$data3->{'author'}; $sth3->finish; if (!$email){ print "<= td>$author"; } else { print ""; } } $sth->finish; $dbh->disconnect; print "
Due Date Patron Pho= ne Tit= le Aut= hor
$duedate$name$phone$title
$duedate$name$phone$title$author
"; print endmenu('report'); print endpage(); --===============4551635062911798772==--