Removed bogus unused variables at the top.
[koha.git] / C4 / Circulation / Borrissues.pm
1 package C4::Circulation::Borrissues; #assumes C4/Circulation/Borrissues
2
3 #package to deal with Issues
4 #written 3/11/99 by chris@katipo.co.nz
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25 require Exporter;
26 use DBI;
27 use C4::Context;
28 use C4::Print;
29 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
30   
31 # set the version for version checking
32 $VERSION = 0.01;
33     
34 @ISA = qw(Exporter);
35 @EXPORT = qw(&printallissues);
36 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
37                   
38 # your exported package globals go here,
39 # as well as any optionally exported functions
40
41 @EXPORT_OK   = qw($Var1 %Hashit);
42
43
44 # non-exported package globals go here
45 use vars qw(@more $stuff);
46         
47 # initalize package globals, first exported ones
48
49 my $Var1   = '';
50 my %Hashit = ();
51                     
52 # then the others (which are still accessible as $Some::Module::stuff)
53 my $stuff  = '';
54 my @more   = ();
55         
56 # all file-scoped lexicals must be created before
57 # the functions below that use them.
58                 
59 # file-private lexicals go here
60 my $priv_var    = '';
61 my %secret_hash = ();
62                             
63 # here's a file-private function as a closure,
64 # callable as &$priv_func;  it cannot be prototyped.
65 my $priv_func = sub {
66   # stuff goes here.
67 };
68                                                     
69 # make all your functions, whether exported or not;
70
71
72 sub printallissues {
73   my ($env,$borrower)=@_;
74   my @issues;
75   my $dbh = C4::Context->dbh;
76   my $query = "select * from issues,items,biblioitems,biblio
77     where borrowernumber = '$borrower->{'borrowernumber'}' 
78     and (returndate is null)
79     and (issues.itemnumber = items.itemnumber)
80     and (items.biblioitemnumber = biblioitems.biblioitemnumber)
81     and (items.biblionumber = biblio.biblionumber) 
82     order by date_due";
83   my $sth = $dbh->prepare($query);
84   $sth->execute();
85   my $x;
86   while (my $data = $sth->fetchrow_hashref) {
87     # FIXME - This should be $issues[$x] = $data, right?
88     # Or better yet, push @issues, $data.
89     @issues[$x] =$data;
90     $x++;
91   }
92   $sth->finish();
93   remoteprint ($env,\@issues,$borrower);
94 }
95 END { }       # module clean-up code here (global destructor)