Added magic RCS comment.
[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 @EXPORT_OK %EXPORT_TAGS);
32   
33 # set the version for version checking
34 $VERSION = 0.01;
35     
36 @ISA = qw(Exporter);
37 @EXPORT = qw(&printallissues);
38 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
39                   
40 # your exported package globals go here,
41 # as well as any optionally exported functions
42
43 @EXPORT_OK   = qw($Var1 %Hashit);
44
45
46 # non-exported package globals go here
47 use vars qw(@more $stuff);
48         
49 # initalize package globals, first exported ones
50
51 my $Var1   = '';
52 my %Hashit = ();
53                     
54 # then the others (which are still accessible as $Some::Module::stuff)
55 my $stuff  = '';
56 my @more   = ();
57         
58 # all file-scoped lexicals must be created before
59 # the functions below that use them.
60                 
61 # file-private lexicals go here
62 my $priv_var    = '';
63 my %secret_hash = ();
64                             
65 # here's a file-private function as a closure,
66 # callable as &$priv_func;  it cannot be prototyped.
67 my $priv_func = sub {
68   # stuff goes here.
69 };
70                                                     
71 # make all your functions, whether exported or not;
72
73 # FIXME - This function is only used in C4::InterfaceCDK, which looks
74 # obsolete. Does that mean that this module is also obsolete?
75 # Otherwise, this needs a POD.
76 sub printallissues {
77   my ($env,$borrower)=@_;
78   my @issues;
79   my $dbh = C4::Context->dbh;
80   my $query = "select * from issues,items,biblioitems,biblio
81     where borrowernumber = '$borrower->{'borrowernumber'}' 
82     and (returndate is null)
83     and (issues.itemnumber = items.itemnumber)
84     and (items.biblioitemnumber = biblioitems.biblioitemnumber)
85     and (items.biblionumber = biblio.biblionumber) 
86     order by date_due";
87   my $sth = $dbh->prepare($query);
88   $sth->execute();
89   my $x;
90   while (my $data = $sth->fetchrow_hashref) {
91     # FIXME - This should be $issues[$x] = $data, right?
92     # Or better yet, push @issues, $data.
93     @issues[$x] =$data;
94     $x++;
95   }
96   $sth->finish();
97   remoteprint ($env,\@issues,$borrower);
98 }