4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
28 my $type=$input->param('type');
30 my $theme = $input->param('theme'); # only used if allowthemeoverride is set
31 my %tmpldata = pathtotemplate ( template => 'overdue.tmpl', theme => $theme);
32 my $template = HTML::Template->new( filename => $tmpldata{'path'},
33 die_on_bad_params => 0);
46 my @datearr = localtime(time());
47 my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
49 my $dbh = C4::Context->dbh;
51 my $query="select date_due,borrowernumber,itemnumber from issues where isnull(returndate) && date_due<'$todaysdate' order by date_due,borrowernumber";
52 my $sth=$dbh->prepare($query);
56 while (my $data=$sth->fetchrow_hashref) {
57 $duedate=$data->{'date_due'};
58 $bornum=$data->{'borrowernumber'};
59 $itemnum=$data->{'itemnumber'};
61 my $query="select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber='$bornum'";
62 my $sth1=$dbh->prepare($query);
64 $data1=$sth1->fetchrow_hashref;
65 $name=$data1->{'concat(firstname,\' \',surname)'};
66 $phone=$data1->{'phone'};
67 $email=$data1->{'emailaddress'};
70 # FIXME - There's already a $query in this scope.
71 my $query="select biblionumber from items where itemnumber='$itemnum'";
72 my $sth2=$dbh->prepare($query);
74 $data2=$sth2->fetchrow_hashref;
75 $biblionumber=$data2->{'biblionumber'};
78 # FIXME - There's already a $query in this scope.
79 my $query="select title,author from biblio where biblionumber='$biblionumber'";
80 my $sth3=$dbh->prepare($query);
82 $data3=$sth3->fetchrow_hashref;
83 $title=$data3->{'title'};
84 $author=$data3->{'author'};
86 push (@overduedata, { duedate => $duedate,
92 biblionumber => $biblionumber,
100 $template->param( startmenureport => join ('', startmenu('report')),
101 endmenureport => join ('', endmenu('report')),
102 todaysdate => $todaysdate,
103 overdueloop => \@overduedata );
105 print "Content-Type: text/html\n\n", $template->output;