fixes missing
[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 use C4::Interface::CGI::Output;
12
13 my $query = new CGI;
14 my ($template, $borrowernumber, $cookie) 
15     = get_template_and_user({template_name => "opac-readingrecord.tmpl",
16                              query => $query,
17                              type => "opac",
18                              authnotrequired => 0,
19                              flagsrequired => {borrow => 1},
20                              debug => 1,
21                              });
22
23 # get borrower information ....
24 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
25
26
27 $template->param($borr);
28
29 # get the record
30 my $order=$query->param('order');
31 my $order2=$order;
32 if ($order2 eq ''){
33   $order2="date_due desc";
34 }
35 my $limit=$query->param('limit');
36 if ($limit eq 'full'){
37   $limit=0;
38 } else {
39   $limit=50;
40 }
41 my ($count,$issues)=allissues($borrowernumber,$order2,$limit);
42
43 # add the row parity
44 my $num = 0;
45 foreach my $row (@$issues) {
46     $row->{'even'} = 1 if $num % 2 == 0;
47     $row->{'odd'} = 1 if $num % 2 == 1;
48     $num++;
49 }
50
51 $template->param(count => $count);
52 $template->param(READING_RECORD => $issues);
53
54
55 output_html_with_http_headers $query, $cookie, $template->output;
56