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
25 use C4::Interface::CGI::Output;
31 my $type = $input->param('type');
33 my $theme = $input->param('theme'); # only used if allowthemeoverride is set
35 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37 template_name => "circ/overdue.tmpl",
41 flagsrequired => { reports => 1 },
57 my @datearr = localtime( time() );
59 ( 1900 + $datearr[5] ) . '-'
60 . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
61 . sprintf( "%0.2d", $datearr[3] );
63 my $dbh = C4::Context->dbh;
67 "select date_due,borrowernumber,itemnumber
69 where isnull(returndate) && date_due<? order by date_due,borrowernumber"
71 $sth->execute($todaysdate);
74 while ( my $data = $sth->fetchrow_hashref ) {
75 $duedate = format_date($data->{'date_due'});
76 $borrowernumber = $data->{'borrowernumber'};
77 $itemnum = $data->{'itemnumber'};
81 "select concat(firstname,' ',surname),phone,email from borrowers where borrowernumber=?"
83 $sth1->execute($borrowernumber);
84 $data1 = $sth1->fetchrow_hashref;
85 $name = $data1->{'concat(firstname,\' \',surname)'};
86 $phone = $data1->{'phone'};
87 $email = $data1->{'email'};
91 $dbh->prepare("select biblionumber from items where itemnumber=?");
92 $sth2->execute($itemnum);
93 $data2 = $sth2->fetchrow_hashref;
94 $biblionumber = $data2->{'biblionumber'};
98 $dbh->prepare("select title,author from biblio where biblionumber=?");
99 $sth3->execute($biblionumber);
100 $data3 = $sth3->fetchrow_hashref;
101 $title = $data3->{'title'};
102 $author = $data3->{'author'};
108 borrowernumber => $borrowernumber,
113 biblionumber => $biblionumber,
121 todaysdate => $todaysdate,
122 overdueloop => \@overduedata
125 output_html_with_http_headers $input, $cookie, $template->output;