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
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
28 use C4::Dates qw/format_date/;
34 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36 template_name => "opac-readingrecord.tmpl",
40 flagsrequired => { borrow => 1 },
45 # get borrower information ....
46 my ( $borr ) = GetMemberDetails( $borrowernumber );
48 $template->param($borr);
50 my $itemtypes = GetItemTypes();
53 my $order = $query->param('order') || '';
55 $order = "date_due desc";
56 $template->param( orderbydate => 1 );
59 if ( $order eq 'title' ) {
60 $template->param( orderbytitle => 1 );
63 if ( $order eq 'author' ) {
64 $template->param( orderbyauthor => 1 );
67 my $limit = $query->param('limit') || 50;
68 if ( $limit eq 'full' ) {
75 my ( $issues ) = GetAllIssues( $borrowernumber, $order, $limit );
79 $template->param( BORROWER_INFO => \@bordat );
83 foreach my $issue (@{$issues} ) {
86 my $record = GetMarcBiblio($issues->[$i]->{'biblionumber'});
89 my $isbn = GetNormalizedISBN($issue->{'isbn'});
90 $line{normalized_isbn} = $isbn;
91 <<<<<<< HEAD:opac/opac-readingrecord.pl
92 $line{biblionumber} = $issues->[$i]->{'biblionumber'};
93 $line{title} = $issues->[$i]->{'title'};
94 $line{author} = $issues->[$i]->{'author'};
95 $line{itemcallnumber} = $issues->[$i]->{'itemcallnumber'};
96 $line{date_due} = format_date( $issues->[$i]->{'date_due'} );
97 $line{returndate} = format_date( $issues->[$i]->{'returndate'} );
98 $line{volumeddesc} = $issues->[$i]->{'volumeddesc'};
99 $line{counter} = $i + 1;
100 if($issues->[$i]->{'itemtype'}) {
101 $line{'itypedescription'} = $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'description'};
102 $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'imageurl'} );
105 $line{biblionumber} = $issue->{'biblionumber'};
106 $line{title} = $issue->{'title'};
107 $line{author} = $issue->{'author'};
108 $line{itemcallnumber} = $issue->{'itemcallnumber'};
109 $line{date_due} = format_date( $issue->{'date_due'} );
110 $line{returndate} = format_date( $issue->{'returndate'} );
111 $line{volumeddesc} = $issue->{'volumeddesc'};
112 $line{'description'} = $itemtypes->{ $issue->{'itemtype'} }->{'description'};
113 $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{'itemtype'} }->{'imageurl'} );
114 >>>>>>> (MT #2920) fix reading record scripts:opac/opac-readingrecord.pl
115 push( @loop_reading, \%line );
116 $line{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($issues->[$i]->{'biblionumber'}));
119 if (C4::Context->preference('BakerTaylorEnabled')) {
122 BakerTaylorEnabled => 1,
123 BakerTaylorImageURL => &image_url(),
124 BakerTaylorLinkURL => &link_url(),
125 BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
130 if (C4::Context->preference('BakerTaylorEnabled')) {
131 require C4::External::BakerTaylor;
132 import C4::External::BakerTaylor qw(&image_url &link_url);
136 for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above
137 C4::Context->preference($_) or next;
138 $template->param($_=>1);
139 $template->param(JacketImages=>1);
143 READING_RECORD => \@loop_reading,
147 count => scalar @loop_reading,
150 output_html_with_http_headers $query, $cookie, $template->output;