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
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 use C4
::Charset
qw(StripNonXmlChars);
36 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
38 template_name
=> "opac-readingrecord.tt",
42 flagsrequired
=> { borrow
=> 1 },
47 # get borrower information ....
48 my ( $borr ) = GetMemberDetails
( $borrowernumber );
50 $template->param(%{$borr});
52 my $itemtypes = GetItemTypes
();
55 my $order = $query->param('order') || '';
56 if ( $order eq 'title' ) {
57 $template->param( orderbytitle
=> 1 );
59 elsif ( $order eq 'author' ) {
60 $template->param( orderbyauthor
=> 1 );
63 $order = "date_due desc";
64 $template->param( orderbydate
=> 1 );
68 my $limit = $query->param('limit');
69 $limit = ( $limit eq 'full' ) ?
0 : 50;
71 my $issues = GetAllIssues
( $borrowernumber, $order, $limit );
74 ( C4
::Context
->preference('item-level_itypes') ) ?
'itype' : 'itemtype';
76 my $opac_summary_html = C4
::Context
->preference('OPACMySummaryHTML');
77 foreach my $issue ( @
{$issues} ) {
78 $issue->{normalized_isbn
} = GetNormalizedISBN
( $issue->{isbn
} );
79 if ( $issue->{$itype_attribute} ) {
80 $issue->{description
} =
81 $itemtypes->{ $issue->{$itype_attribute} }->{description
};
83 getitemtypeimagelocation
( 'opac',
84 $itemtypes->{ $issue->{$itype_attribute} }->{imageurl
} );
86 if ( $issue->{marcxml
} ) {
87 my $marcxml = StripNonXmlChars
( $issue->{marcxml
} );
89 MARC
::Record
::new_from_xml
( $marcxml, 'utf8',
90 C4
::Context
->preference('marcflavour') );
92 GetRecordValue
( 'subtitle', $marc_rec, $issue->{frameworkcode
} );
95 if ($opac_summary_html) {
96 my $my_summary_html = $opac_summary_html;
98 ?
$my_summary_html =~ s/{AUTHOR}/$issue->{author}/g
99 : $my_summary_html =~ s/{AUTHOR}//g;
100 my $title = $issue->{title
};
101 $title =~ s/\/+$//; # remove trailing slash
102 $title =~ s/\s+$//; # remove trailing space
104 ?
$my_summary_html =~ s/{TITLE}/$title/g
105 : $my_summary_html =~ s/{TITLE}//g;
106 $issue->{normalized_isbn
}
107 ?
$my_summary_html =~ s/{ISBN}/$issue->{normalized_isbn}/g
108 : $my_summary_html =~ s/{ISBN}//g;
109 $issue->{biblionumber
}
110 ?
$my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g
111 : $my_summary_html =~ s/{BIBLIONUMBER}//g;
112 $issue->{MySummaryHTML
} = $my_summary_html;
116 if (C4
::Context
->preference('BakerTaylorEnabled')) {
119 BakerTaylorEnabled
=> 1,
120 BakerTaylorImageURL
=> &image_url
(),
121 BakerTaylorLinkURL
=> &link_url
(),
122 BakerTaylorBookstoreURL
=> C4
::Context
->preference('BakerTaylorBookstoreURL'),
127 if (C4
::Context
->preference('BakerTaylorEnabled')) {
128 require C4
::External
::BakerTaylor
;
129 import C4
::External
::BakerTaylor
qw(&image_url &link_url);
133 for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above
134 C4
::Context
->preference($_) or next;
135 $template->param($_=>1);
136 $template->param(JacketImages
=>1);
140 READING_RECORD
=> $issues,
144 OPACMySummaryHTML
=> $opac_summary_html ?
1 : 0,
147 output_html_with_http_headers
$query, $cookie, $template->output;