fixed a couple of bugs. Note this version of opac-reserve.pl is designed to work...
[koha.git] / opac / opac-readingrecord.pl
1 #!/usr/bin/perl
2 use strict;
3 require Exporter;
4 use CGI;
5
6 use C4::Auth;
7 use C4::Koha;
8 use C4::Circulation::Circ2;
9 use C4::Search;
10 use HTML::Template;
11
12 my $query = new CGI;
13 my ($template, $borrowernumber, $cookie) 
14     = get_template_and_user({template_name => "opac-readingrecord.tmpl",
15                              query => $query,
16                              type => "opac",
17                              authnotrequired => 0,
18                              flagsrequired => {borrow => 1},
19                              debug => 1,
20                              });
21
22 # get borrower information ....
23 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
24
25
26 $template->param($borr);
27
28 # get the record
29 my $order=$query->param('order');
30 my $order2=$order;
31 if ($order2 eq ''){
32   $order2="date_due desc";
33 }
34 my $limit=$query->param('limit');
35 if ($limit eq 'full'){
36   $limit=0;
37 } else {
38   $limit=50;
39 }
40 my ($count,$issues)=allissues($borrowernumber,$order2,$limit);
41
42 # add the row parity
43 my $num = 0;
44 foreach my $row (@$issues) {
45     $row->{'even'} = 1 if $num % 2 == 0;
46     $row->{'odd'} = 1 if $num % 2 == 1;
47     $num++;
48 }
49
50 $template->param(count => $count);
51 $template->param(READING_RECORD => $issues);
52
53
54 output_html_with_http_headers $query, $cookie, $template->output;
55