View | Details | Raw Unified | Return to bug 33949
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt (-41 / +55 lines)
Lines 47-54 Link Here
47
47
48
                <div id="userreadingrecord" class="maincontent">
48
                <div id="userreadingrecord" class="maincontent">
49
                    <h1>Checkout history</h1>
49
                    <h1>Checkout history</h1>
50
50
                    [% SET all_checkouts = checkouts.merge(old_checkouts) %]
51
                    [% IF READING_RECORD.size == 0 %]
51
                    [% IF all_checkouts.size == 0 %]
52
                        You have never borrowed anything from this library.
52
                        You have never borrowed anything from this library.
53
                    [% ELSE %]
53
                    [% ELSE %]
54
                        <div id="opac-user-readingrec">
54
                        <div id="opac-user-readingrec">
Lines 109-193 Link Here
109
                                                <th>Call number</th>
109
                                                <th>Call number</th>
110
                                                <th>Vol info</th>
110
                                                <th>Vol info</th>
111
                                                <th>Date</th>
111
                                                <th>Date</th>
112
                                                [% IF ( OPACMySummaryHTML ) %]
112
                                                [% IF Koha.Preference('OPACMySummaryHTML') %]
113
                                                    <th class="NoSort noExport">Links</th>
113
                                                    <th class="NoSort noExport">Links</th>
114
                                                [% END %]
114
                                                [% END %]
115
                                            </tr>
115
                                            </tr>
116
                                        </thead>
116
                                        </thead>
117
                                        <tbody>
117
                                        <tbody>
118
                                            [% FOREACH issue IN READING_RECORD %]
118
                                            [% FOREACH checkout IN all_checkouts %]
119
                                                [% SET item = checkout.item %]
120
                                                [% SET biblio = item.biblio %]
119
                                                <tr>
121
                                                <tr>
120
                                                    <td style="display:none;">
122
                                                    <td style="display:none;">
121
                                                      [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
123
                                                      [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' %]
122
                                                      [% ELSE %][% issuetype = 'standard_checkout' %]
124
                                                      [% ELSE %][% issuetype = 'standard_checkout' %]
123
                                                      [% END %]
125
                                                      [% END %]
124
                                                      [% issuetype | html %]
126
                                                      [% issuetype | html %]
125
                                                    </td>
127
                                                    </td>
126
                                                <td>
128
                                                <td>
127
                                                    [% IF  OPACAmazonCoverImages %]
129
                                                    [% SET normalized_isbn = biblio.normalized_isbn %]
128
                                                        [% IF  issue.normalized_isbn %]
130
                                                    [% IF OPACAmazonCoverImages %]
129
                                                            <a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
131
                                                        [% IF normalized_isbn %]
132
                                                            <a href="http://www.amazon.com/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
130
                                                        [% ELSE %]
133
                                                        [% ELSE %]
131
                                                             <span class="no-image">No cover image available</span>
134
                                                             <span class="no-image">No cover image available</span>
132
                                                        [% END %]
135
                                                        [% END %]
133
                                                    [% END %]
136
                                                    [% END %]
134
137
135
                                                [% IF GoogleJackets %]
138
                                                    [% IF GoogleJackets %]
136
                                                    [% IF  issue.normalized_isbn %]
139
                                                        [% IF normalized_isbn %]
137
                                                        <div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
140
                                                            <div title="[% biblio.biblionumber |url %]" class="[% normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
138
                                                    [% ELSE %]
141
                                                        [% ELSE %]
139
                                                       <span class="no-image">No cover image available</span>
142
                                                           <span class="no-image">No cover image available</span>
143
                                                        [% END %]
140
                                                    [% END %]
144
                                                    [% END %]
141
                                                [% END %]
142
145
143
                                                [% IF BakerTaylorEnabled %]
146
                                                    [% IF BakerTaylorEnabled || SyndeticsEnabled && SyndeticsCoverImages %]
144
                                                    [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
147
                                                        [% SET normalized_upc = biblio.normalized_upc %]
145
                                                    [% IF ( bt_id ) %]
148
                                                    [% END %]
146
                                                       <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
149
                                                    [% IF BakerTaylorEnabled %]
147
                                                    [% ELSE %]
150
                                                        [% bt_id = ( normalized_upc || normalized_isbn ) %]
148
                                                       <span class="no-image">No cover image available</span>
151
                                                        [% IF ( bt_id ) %]
152
                                                           <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
153
                                                        [% ELSE %]
154
                                                           <span class="no-image">No cover image available</span>
155
                                                        [% END %]
149
                                                    [% END %]
156
                                                    [% END %]
150
                                                [% END %]
151
157
152
                                                [% IF SyndeticsEnabled && SyndeticsCoverImages %]
158
                                                    [% IF SyndeticsEnabled && SyndeticsCoverImages %]
153
                                                    <img src="https://secure.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% issue.normalized_upc | html %]&amp;oclc=[% issue.normalized_oclc | html %]" alt="" class="item-thumbnail" />
159
                                                        [%# FIXME Might need more work here, depending on the decision of 33951 %]
154
                                                [% END %]
160
                                                        [%# Either remove the oclc parameter or create a Koha::Biblio->normalized_oclc method %]
161
                                                        <img src="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% normalized_upc | html %]&amp;oclc=[% biblio.normalized_oclc | html %]" alt="" class="item-thumbnail" />
162
                                                    [% END %]
155
                                                </td>
163
                                                </td>
156
                                                <td>
164
                                                <td>
157
                                                [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %]
165
                                                    [% INCLUDE 'biblio-title.inc' biblio=biblio, link => 1 %]
158
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
166
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
159
                                                        [% INCLUDE 'user-star-ratings.inc' item=issue %]
167
                                                        [% SET ratings = {ratings => biblio.ratings, itemnumber => item.itemnumber, biblionumber => biblio.biblionumber, my_rating => biblio.ratings.search( borrowernumber => logged_in_user.borrowernumber ).next } %]
168
                                                        [% INCLUDE 'user-star-ratings.inc' item=ratings %]
160
                                                    [% END %]
169
                                                    [% END %]
161
                                                </td>
170
                                                </td>
162
                                                <td>[% issue.author | html %]</td>
171
                                                <td>[% biblio.author | html %]</td>
163
                                                <td>
172
                                                <td>
164
                                                [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
173
                                                    [% SET item_type = item_types.${item.effective_itemtype} %]
165
                                                    [% IF ( issue.imageurl ) %]
174
                                                    [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
166
                                                        <img src="[% issue.imageurl | html %]" alt="" />
175
                                                        [% SET image_location = item_type.image_location %]
176
                                                        [% IF image_location %]
177
                                                            <img src="[% image_location | html %]" alt="" />
178
                                                        [% END %]
167
                                                    [% END %]
179
                                                    [% END %]
168
                                                [% END %]
180
                                                    <span class="itypetext">
169
                                                <span class="itypetext"><span class="tdlabel">Item type:</span>
181
                                                        <span class="tdlabel">Item type:</span>
170
                                                [% issue.translated_description | html %]</span></td>
182
                                                        [% item_type.translated_description | html %]
183
                                                    </span>
184
                                                </td>
171
                                                <td>
185
                                                <td>
172
                                                <span class="tdlabel">Call number:</span>
186
                                                <span class="tdlabel">Call number:</span>
173
                                                [% issue.itemcallnumber | html %]
187
                                                    [% item.itemcallnumber | html %]
174
                                                </td>
188
                                                </td>
175
                                                <td>
189
                                                <td>
176
                                                    [% IF issue.enumchron %]
190
                                                    [% IF item.enumchron %]
177
                                                        [% issue.enumchron | html %]
191
                                                        [% item.enumchron | html %]
178
                                                    [% END %]
192
                                                    [% END %]
179
                                                </td>
193
                                                </td>
180
                                                [% IF issue.returndate %]
194
                                                [% IF checkout.returndate %]
181
                                                    <td data-order="[% issue.returndate | html %]">
195
                                                    <td data-order="[% checkout.returndate | html %]">
182
                                                        <span class="tdlabel">Check-in date:</span>
196
                                                        <span class="tdlabel">Check-in date:</span>
183
                                                        [% issue.returndate | $KohaDates %]
197
                                                        [% checkout.returndate | $KohaDates %]
184
                                                [% ELSE %]
198
                                                [% ELSE %]
185
                                                    <td data-order="Checked out">
199
                                                    <td data-order="Checked out">
186
                                                        <em>(Checked out)</em>
200
                                                        <em>(Checked out)</em>
187
                                                [% END %]
201
                                                [% END %]
188
                                                </td>
202
                                                </td>
189
                                                [% IF OPACMySummaryHTML %]
203
                                                [% IF Koha.Preference('OPACMySummaryHTML') %]
190
                                                    <td>[% issue.MySummaryHTML | $raw %]</td>
204
                                                    <td>[% biblio.opac_summary_html | $raw %]</td>
191
                                                [% END %]
205
                                                [% END %]
192
                                                </tr>
206
                                                </tr>
193
                                            [% END # / FOREACH issue %]
207
                                            [% END # / FOREACH issue %]
(-)a/opac/opac-readingrecord.pl (-70 / +28 lines)
Lines 21-42 use Modern::Perl; Link Here
21
use CGI qw ( -utf8 );
21
use CGI qw ( -utf8 );
22
22
23
use C4::Auth qw( get_template_and_user );
23
use C4::Auth qw( get_template_and_user );
24
use C4::Koha qw(
25
    getitemtypeimagelocation
26
    GetNormalizedISBN
27
    GetNormalizedUPC
28
);
29
use C4::Biblio;
24
use C4::Biblio;
30
use C4::Members qw( GetAllIssues );
31
use C4::External::BakerTaylor qw( image_url link_url );
25
use C4::External::BakerTaylor qw( image_url link_url );
32
use MARC::Record;
26
use MARC::Record;
33
27
34
use C4::Output qw( output_html_with_http_headers );
28
use C4::Output qw( output_html_with_http_headers );
35
use C4::Charset qw( StripNonXmlChars );
36
use Koha::Patrons;
29
use Koha::Patrons;
37
30
38
use Koha::ItemTypes;
31
use Koha::ItemTypes;
39
use Koha::Ratings;
40
32
41
my $query = CGI->new;
33
my $query = CGI->new;
42
34
Lines 54-60 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
54
    }
46
    }
55
);
47
);
56
48
57
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
49
my $patron = Koha::Patrons->find( $borrowernumber );
50
my @itemtypes = Koha::ItemTypes->search_with_localization->as_list;
51
my %item_types = map {
52
    $_->itemtype => $_
53
} @itemtypes;
54
$template->param(item_types => \%item_types);
58
55
59
# get the record
56
# get the record
60
my $order = $query->param('order') || '';
57
my $order = $query->param('order') || '';
Lines 74-137 my $limit = $query->param('limit'); Link Here
74
$limit //= '';
71
$limit //= '';
75
$limit = ( $limit eq 'full' ) ? 0 : 50;
72
$limit = ( $limit eq 'full' ) ? 0 : 50;
76
73
77
my $issues = GetAllIssues( $borrowernumber, $order, $limit );
74
my $checkouts = [
78
75
    $patron->checkouts(
79
my $itype_attribute =
76
        {},
80
  ( C4::Context->preference('item-level_itypes') ) ? 'itype' : 'itemtype';
77
        {
81
78
            order_by => $order,
82
my $opac_summary_html = C4::Context->preference('OPACMySummaryHTML');
79
            prefetch => { item => { biblio => 'biblioitems' } },
83
foreach my $issue ( @{$issues} ) {
80
            ( $limit ? ( limit => $limit ) : () ),
84
    $issue->{normalized_isbn} = GetNormalizedISBN( $issue->{isbn} );
85
    if ( $issue->{$itype_attribute} ) {
86
        $issue->{translated_description} =
87
          $itemtypes->{ $issue->{$itype_attribute} }->{translated_description};
88
        $issue->{imageurl} =
89
          getitemtypeimagelocation( 'opac',
90
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
91
    }
92
93
    if (   C4::Context->preference('BakerTaylorEnabled')
94
        || C4::Context->preference('SyndeticsEnabled')
95
        || C4::Context->preference('SyndeticsCoverImages') )
96
    {
97
        my $marcxml = C4::Biblio::GetXmlBiblio( $issue->{biblionumber} );
98
        if ( $marcxml ) {
99
            $marcxml = StripNonXmlChars( $marcxml );
100
            my $marc_rec =
101
              MARC::Record::new_from_xml( $marcxml, 'UTF-8',
102
                C4::Context->preference('marcflavour') );
103
            $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') );
104
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber($marc_rec, C4::Context->preference('marcflavour'));
105
        }
81
        }
106
82
    )->as_list
107
    }
83
];
108
    # My Summary HTML
84
$limit -= scalar(@$checkouts) if $limit;
109
    if ($opac_summary_html) {
85
my $old_checkouts = [
110
        my $my_summary_html = $opac_summary_html;
86
    $patron->old_checkouts(
111
        $issue->{author}
87
        {},
112
          ? $my_summary_html =~ s/{AUTHOR}/$issue->{author}/g
88
        {
113
          : $my_summary_html =~ s/{AUTHOR}//g;
89
            order_by => $order,
114
        my $title = $issue->{title};
90
            prefetch => { item => { biblio => 'biblioitems' } },
115
        $title =~ s/\/+$//;    # remove trailing slash
91
            ( $limit ? ( limit => $limit ) : () ),
116
        $title =~ s/\s+$//;    # remove trailing space
92
        }
117
        $title
93
    )->as_list
118
          ? $my_summary_html =~ s/{TITLE}/$title/g
94
];
119
          : $my_summary_html =~ s/{TITLE}//g;
120
        $issue->{normalized_isbn}
121
          ? $my_summary_html =~ s/{ISBN}/$issue->{normalized_isbn}/g
122
          : $my_summary_html =~ s/{ISBN}//g;
123
        $issue->{biblionumber}
124
          ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g
125
          : $my_summary_html =~ s/{BIBLIONUMBER}//g;
126
        $issue->{MySummaryHTML} = $my_summary_html;
127
    }
128
    # Star ratings
129
    if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
130
        my $ratings = Koha::Ratings->search({ biblionumber => $issue->{biblionumber} });
131
        $issue->{ratings} = $ratings;
132
        $issue->{my_rating} = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef;
133
    }
134
}
135
95
136
if (C4::Context->preference('BakerTaylorEnabled')) {
96
if (C4::Context->preference('BakerTaylorEnabled')) {
137
	$template->param(
97
	$template->param(
Lines 151-165 for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above Link Here
151
111
152
my $saving_display = C4::Context->preference('OPACShowSavings');
112
my $saving_display = C4::Context->preference('OPACShowSavings');
153
if ( $saving_display =~ /checkouthistory/ ) {
113
if ( $saving_display =~ /checkouthistory/ ) {
154
    my $patron = Koha::Patrons->find( $borrowernumber );
155
    $template->param( savings => $patron->get_savings );
114
    $template->param( savings => $patron->get_savings );
156
}
115
}
157
116
158
$template->param(
117
$template->param(
159
    READING_RECORD => $issues,
118
    checkouts => $checkouts,
119
    old_checkouts => $old_checkouts,
160
    limit          => $limit,
120
    limit          => $limit,
161
    readingrecview => 1,
121
    readingrecview => 1,
162
    OPACMySummaryHTML => $opac_summary_html ? 1 : 0,
163
);
122
);
164
123
165
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
124
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
166
- 

Return to bug 33949