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 ($template, $loggedinuser, $cookie)
33 = get_template_and_user({template_name => "overdue.tmpl",
37 flagsrequired => {catalogue => 1},
52 my @datearr = localtime(time());
53 my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
55 my $dbh = C4::Context->dbh;
57 my $query="select date_due,borrowernumber,itemnumber from issues where isnull(returndate) && date_due<'$todaysdate' order by date_due,borrowernumber";
58 my $sth=$dbh->prepare($query);
62 while (my $data=$sth->fetchrow_hashref) {
63 $duedate=$data->{'date_due'};
64 $bornum=$data->{'borrowernumber'};
65 $itemnum=$data->{'itemnumber'};
67 my $query="select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber='$bornum'";
68 my $sth1=$dbh->prepare($query);
70 $data1=$sth1->fetchrow_hashref;
71 $name=$data1->{'concat(firstname,\' \',surname)'};
72 $phone=$data1->{'phone'};
73 $email=$data1->{'emailaddress'};
76 # FIXME - There's already a $query in this scope.
77 my $query="select biblionumber from items where itemnumber='$itemnum'";
78 my $sth2=$dbh->prepare($query);
80 $data2=$sth2->fetchrow_hashref;
81 $biblionumber=$data2->{'biblionumber'};
84 # FIXME - There's already a $query in this scope.
85 my $query="select title,author from biblio where biblionumber='$biblionumber'";
86 my $sth3=$dbh->prepare($query);
88 $data3=$sth3->fetchrow_hashref;
89 $title=$data3->{'title'};
90 $author=$data3->{'author'};
92 push (@overduedata, { duedate => $duedate,
98 biblionumber => $biblionumber,
100 author => $author });
106 $template->param( startmenureport => join ('', startmenu('report')),
107 endmenureport => join ('', endmenu('report')),
108 todaysdate => $todaysdate,
109 overdueloop => \@overduedata );
111 print "Content-Type: text/html\n\n", $template->output;