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