fix for #318
[koha.git] / C4 / Circulation / Borrissues.pm
1 package C4::Circulation::Borrissues;
2
3 # $Id$
4
5 #package to deal with Issues
6 #written 3/11/99 by chris@katipo.co.nz
7
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
16 # version.
17 #
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA  02111-1307 USA
25
26 use strict;
27 require Exporter;
28 use DBI;
29 use C4::Context;
30 use C4::Print;
31 use vars qw($VERSION @ISA @EXPORT);
32
33 # set the version for version checking
34 $VERSION = 0.01;
35
36 @ISA = qw(Exporter);
37 @EXPORT = qw(&printallissues);
38
39 # FIXME - This function is only used in C4::InterfaceCDK, which looks
40 # obsolete. Does that mean that this module is also obsolete?
41 # Otherwise, this needs a POD.
42 sub printallissues {
43   my ($env,$borrower)=@_;
44   my @issues;
45   my $dbh = C4::Context->dbh;
46   my $sth = $dbh->prepare("select * from issues,items,biblioitems,biblio
47     where borrowernumber = ?
48     and (returndate is null)
49     and (issues.itemnumber = items.itemnumber)
50     and (items.biblioitemnumber = biblioitems.biblioitemnumber)
51     and (items.biblionumber = biblio.biblionumber)
52     order by date_due");
53   $sth->execute($borrower->{'borrowernumber'});
54   my $x;
55   while (my $data = $sth->fetchrow_hashref) {
56     # FIXME - This should be $issues[$x] = $data, right?
57     # Or better yet, push @issues, $data.
58     @issues[$x] =$data;
59     $x++;
60   }
61   $sth->finish();
62   remoteprint ($env,\@issues,$borrower);
63 }