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