functions that were in C4::Interface::CGI::Output are now in C4::Output.
[wip/koha-chris_n.git] / members / readingrec.pl
1 #!/usr/bin/perl
2
3 # written 27/01/2000
4 # script to display borrowers reading record
5
6 # Copyright 2000-2002 Katipo Communications
7 #
8 # This file is part of Koha.
9 #
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
14 #
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA  02111-1307 USA
22
23 use strict;
24 use C4::Auth;
25 use C4::Output;
26 use CGI;
27 use C4::Members;
28
29 use C4::Date;
30 my $input=new CGI;
31
32
33 my $borrowernumber=$input->param('borrowernumber');
34 #get borrower details
35 my $data=GetMember($borrowernumber,'borrowernumber');
36 my $order=$input->param('order');
37 my $order2=$order;
38 if ($order2 eq ''){
39   $order2="date_due desc";
40 }
41 my $limit=$input->param('limit');
42
43 if ($limit){
44     if ($limit eq 'full'){
45         $limit=0;
46     }
47
48 else {
49   $limit=50;
50 }
51 my ($count,$issues)=GetAllIssues($borrowernumber,$order2,$limit);
52
53 my ($template, $loggedinuser, $cookie)
54 = get_template_and_user({template_name => "members/readingrec.tmpl",
55                                 query => $input,
56                                 type => "intranet",
57                                 authnotrequired => 0,
58                                 flagsrequired => {borrowers => 1},
59                                 debug => 1,
60                                 });
61
62 my @loop_reading;
63
64 for (my $i=0;$i<$count;$i++){
65         my %line;
66         if($i%2){
67                 $line{'toggle'} = 1;
68         }
69         $line{biblionumber}=$issues->[$i]->{'biblionumber'};
70         $line{title}=$issues->[$i]->{'title'};
71         $line{author}=$issues->[$i]->{'author'};
72         $line{classification} = $issues->[$i]->{'classification'};
73         $line{date_due}=format_date($issues->[$i]->{'date_due'});
74         $line{returndate}=format_date($issues->[$i]->{'returndate'});
75         $line{volumeddesc}=$issues->[$i]->{'volumeddesc'};
76         push(@loop_reading,\%line);
77 }
78
79 $template->param(
80                                                 biblionumber => $data->{'biblionumber'},
81                                                 title => $data->{'title'},
82                                                 initials => $data->{'initials'},
83                                                 surname => $data->{'surname'},
84                                                 borrowernumber => $borrowernumber,
85                                                 limit => $limit,
86                                                 firstname => $data->{'firstname'},
87                                                 cardnumber => $data->{'cardnumber'},
88                                                 showfulllink => ($count > 50),                                  
89                                                 loop_reading => \@loop_reading);
90 output_html_with_http_headers $input, $cookie, $template->output;
91
92
93