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
30 my $type=$input->param('type');
32 my $theme = $input->param('theme'); # only used if allowthemeoverride is set
34 my ($template, $loggedinuser, $cookie)
35 = get_template_and_user({template_name => "overdue.tmpl",
39 flagsrequired => {borrowers => 1},
54 my @datearr = localtime(time());
55 my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
57 my $dbh = C4::Context->dbh;
59 my $sth=$dbh->prepare("select date_due,borrowernumber,itemnumber from issues where isnull(returndate) && date_due<? order by date_due,borrowernumber");
60 $sth->execute($todaysdate);
63 while (my $data=$sth->fetchrow_hashref) {
64 $duedate=$data->{'date_due'};
65 $bornum=$data->{'borrowernumber'};
66 $itemnum=$data->{'itemnumber'};
68 my $sth1=$dbh->prepare("select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber=?");
69 $sth1->execute($bornum);
70 $data1=$sth1->fetchrow_hashref;
71 $name=$data1->{'concat(firstname,\' \',surname)'};
72 $phone=$data1->{'phone'};
73 $email=$data1->{'emailaddress'};
76 my $sth2=$dbh->prepare("select biblionumber from items where itemnumber=?");
77 $sth2->execute($itemnum);
78 $data2=$sth2->fetchrow_hashref;
79 $biblionumber=$data2->{'biblionumber'};
82 my $sth3=$dbh->prepare("select title,author from biblio where biblionumber=?");
83 $sth3->execute($biblionumber);
84 $data3=$sth3->fetchrow_hashref;
85 $title=$data3->{'title'};
86 $author=$data3->{'author'};
88 push (@overduedata, { duedate => $duedate,
94 biblionumber => $biblionumber,
102 $template->param( todaysdate => $todaysdate,
103 overdueloop => \@overduedata );
105 print "Content-Type: text/html\n\n", $template->output;