oops, removing un-needed $dbh->commit() calls
[koha.git] / opac / opac-readingrecord.pl
bloba52170e6f97233ed83cdbfca3b9aef886484038a
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
19 use strict;
20 require Exporter;
21 use CGI;
23 use C4::Auth;
24 use C4::Koha;
25 use C4::Circulation;
26 use C4::Dates qw/format_date/;
27 use C4::Members;
29 use C4::Output;
31 my $query = new CGI;
32 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34 template_name => "opac-readingrecord.tmpl",
35 query => $query,
36 type => "opac",
37 authnotrequired => 0,
38 flagsrequired => { borrow => 1 },
39 debug => 1,
43 # get borrower information ....
44 my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
46 $template->param($borr);
48 # get the record
49 my $order = $query->param('order');
50 my $order2 = $order;
51 if ( $order2 eq '' ) {
52 $order2 = "date_due desc";
53 $template->param( orderbydate => 1 );
56 if ( $order2 eq 'title' ) {
57 $template->param( orderbytitle => 1 );
60 if ( $order2 eq 'author' ) {
61 $template->param( orderbyauthor => 1 );
64 my $limit = $query->param('limit');
65 if ( $limit eq 'full' ) {
66 $limit = 0;
68 else {
69 $limit = 50;
72 my ( $count, $issues ) = GetAllIssues( $borrowernumber, $order2, $limit );
74 # add the row parity
75 #my $num = 0;
76 #foreach my $row (@$issues) {
77 # $row->{'even'} = 1 if $num % 2 == 0;
78 # $row->{'odd'} = 1 if $num % 2 == 1;
79 # $num++;
82 my @loop_reading;
84 for ( my $i = 0 ; $i < $count ; $i++ ) {
85 my %line;
86 if ( $i % 2 ) {
87 $line{'toggle'} = 1;
89 $line{biblionumber} = $issues->[$i]->{'biblionumber'};
90 $line{title} = $issues->[$i]->{'title'};
91 $line{author} = $issues->[$i]->{'author'};
92 $line{classification} = $issues->[$i]->{'classification'};
93 $line{date_due} = format_date( $issues->[$i]->{'date_due'} );
94 $line{returndate} = format_date( $issues->[$i]->{'returndate'} );
95 $line{volumeddesc} = $issues->[$i]->{'volumeddesc'};
96 $line{counter} = $i + 1;
97 push( @loop_reading, \%line );
100 $template->param(
101 count => $count,
102 READING_RECORD => \@loop_reading,
103 limit => $limit,
104 showfulllink => 1,
107 output_html_with_http_headers $query, $cookie, $template->output;