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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt (-39 / +51 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 96-111 Link Here
96
                                    [% END # /WRAPPER tabs_nav %]
96
                                    [% END # /WRAPPER tabs_nav %]
97
                                    [% WRAPPER tab_panels %]
97
                                    [% WRAPPER tab_panels %]
98
                                        [% WRAPPER tab_panel tabname="tabs-container" bt_active= 1 %]
98
                                        [% WRAPPER tab_panel tabname="tabs-container" bt_active= 1 %]
99
                                            [% PROCESS checkout_history_table %]
99
                                            [% PROCESS checkout_history_table checkouts=all_checkouts %]
100
                                        [% END # /tab_panel# %]
100
                                        [% END # /tab_panel# %]
101
                                    [% END # /WRAPPER tab_panels %]
101
                                    [% END # /WRAPPER tab_panels %]
102
                                [% END # /WRAPPER tabs %]
102
                                [% END # /WRAPPER tabs %]
103
                            [% ELSE %]
103
                            [% ELSE %]
104
                                [% PROCESS checkout_history_table %]
104
                                [% PROCESS checkout_history_table checkouts=all_checkouts %]
105
                            [% END %]
105
                            [% END %]
106
106
107
                        </div> <!-- / .opac-user-readingrec -->
107
                        </div> <!-- / .opac-user-readingrec -->
108
                    [% END # / IF READING_RECORD.size %]
108
                    [% END # / IF checkouts.size == 0 %]
109
                </div> <!-- / .userreadingrecord -->
109
                </div> <!-- / .userreadingrecord -->
110
            </div> <!-- / .col-lg-10 -->
110
            </div> <!-- / .col-lg-10 -->
111
        </div> <!-- / .row -->
111
        </div> <!-- / .row -->
Lines 125-215 Link Here
125
                <th>Call number</th>
125
                <th>Call number</th>
126
                <th>Vol info</th>
126
                <th>Vol info</th>
127
                <th>Date</th>
127
                <th>Date</th>
128
                [% IF ( OPACMySummaryHTML ) %]
128
                [% IF Koha.Preference('OPACMySummaryHTML') %]
129
                    <th class="NoSort noExport">Links</th>
129
                    <th class="NoSort noExport">Links</th>
130
                [% END %]
130
                [% END %]
131
                <th></th>
131
                <th></th>
132
            </tr>
132
            </tr>
133
        </thead>
133
        </thead>
134
        <tbody>
134
        <tbody>
135
            [% FOREACH issue IN READING_RECORD %]
135
            [% FOREACH checkout IN checkouts %]
136
                [% SET item = checkout.item %]
137
                [% SET biblio = item.biblio %]
136
                <tr>
138
                <tr>
137
                    <td style="display:none;">
139
                    <td style="display:none;">
138
                        [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
140
                        [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' %]
139
                        [% ELSE %][% issuetype = 'standard_checkout' %]
141
                        [% ELSE %][% issuetype = 'standard_checkout' %]
140
                        [% END %]
142
                        [% END %]
141
                        [% issuetype | html %]
143
                        [% issuetype | html %]
142
                    </td>
144
                    </td>
143
                    <td>
145
                    <td>
144
                        [% IF  OPACAmazonCoverImages %]
146
                        [% SET normalized_isbn = biblio.normalized_isbn %]
145
                            [% IF  issue.normalized_isbn %]
147
                        [% IF OPACAmazonCoverImages %]
146
                                <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>
148
                            [% IF normalized_isbn %]
149
                                <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>
147
                            [% ELSE %]
150
                            [% ELSE %]
148
                                <span class="no-image">No cover image available</span>
151
                                <span class="no-image">No cover image available</span>
149
                            [% END %]
152
                            [% END %]
150
                        [% END %]
153
                        [% END %]
151
154
152
                        [% IF GoogleJackets %]
155
                        [% IF GoogleJackets %]
153
                            [% IF  issue.normalized_isbn %]
156
                            [% IF normalized_isbn %]
154
                                <div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
157
                                <div title="[% biblio.biblionumber |url %]" class="[% normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
155
                            [% ELSE %]
158
                            [% ELSE %]
156
                            <span class="no-image">No cover image available</span>
159
                               <span class="no-image">No cover image available</span>
157
                            [% END %]
160
                            [% END %]
158
                        [% END %]
161
                        [% END %]
159
162
160
                        [% IF BakerTaylorEnabled %]
163
                         [% IF BakerTaylorEnabled || SyndeticsEnabled && SyndeticsCoverImages %]
161
                            [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
164
                             [% SET normalized_upc = biblio.normalized_upc %]
162
                            [% IF ( bt_id ) %]
165
                         [% END %]
163
                            <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
166
                         [% IF BakerTaylorEnabled %]
164
                            [% ELSE %]
167
                             [% bt_id = ( normalized_upc || normalized_isbn ) %]
165
                            <span class="no-image">No cover image available</span>
168
                             [% IF ( bt_id ) %]
166
                            [% END %]
169
                                <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
170
                             [% ELSE %]
171
                                <span class="no-image">No cover image available</span>
172
                             [% END %]
167
                        [% END %]
173
                        [% END %]
168
174
169
                        [% IF SyndeticsEnabled && SyndeticsCoverImages %]
175
                        [% IF SyndeticsEnabled && SyndeticsCoverImages %]
170
                            <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" />
176
                            <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" />
171
                        [% END %]
177
                        [% END %]
172
                    </td>
178
                    </td>
173
                    <td>
179
                    <td>
174
                        [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %]
180
                        [% INCLUDE 'biblio-title.inc' biblio=biblio, link => 1 %]
175
                        [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
181
                        [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
176
                            [% INCLUDE 'user-star-ratings.inc' item=issue %]
182
                            [% SET ratings = {ratings => biblio.ratings, itemnumber => item.itemnumber, biblionumber => biblio.biblionumber, my_rating => biblio.ratings.search( borrowernumber => logged_in_user.borrowernumber ).next } %]
183
                            [% INCLUDE 'user-star-ratings.inc' item=ratings %]
177
                        [% END %]
184
                        [% END %]
178
                    </td>
185
                    </td>
179
                    <td>[% issue.author | html %]</td>
186
                    <td>[% biblio.author | html %]</td>
180
                    <td>
187
                    <td>
188
                        [% SET item_type = item_types.${item.effective_itemtype} %]
181
                        [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
189
                        [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
182
                            [% IF ( issue.imageurl ) %]
190
                            [% SET image_location = item_type.image_location %]
183
                                <img src="[% issue.imageurl | html %]" alt="" />
191
                            [% IF image_location %]
192
                                <img src="[% image_location | html %]" alt="" />
184
                            [% END %]
193
                            [% END %]
185
                        [% END %]
194
                        [% END %]
186
                        <span class="itypetext"><span class="tdlabel">Item type:</span>
195
                        <span class="itypetext">
187
                        [% issue.translated_description | html %]</span>
196
                            <span class="tdlabel">Item type:</span>
197
                            [% item_type.translated_description | html %]
198
                        </span>
188
                    </td>
199
                    </td>
189
                    <td>
200
                    <td>
190
                        <span class="tdlabel">Call number:</span>
201
                        <span class="tdlabel">Call number:</span>
191
                        [% issue.itemcallnumber | html %]
202
                        [% item.itemcallnumber | html %]
192
                    </td>
203
                    </td>
193
                    <td>
204
                    <td>
194
                        [% IF issue.enumchron %]
205
                        [% IF item.enumchron %]
195
                            [% issue.enumchron | html %]
206
                            [% item.enumchron | html %]
196
                        [% END %]
207
                        [% END %]
197
                    </td>
208
                    </td>
198
                    [% IF issue.returndate %]
209
                    [% IF checkout.returndate %]
199
                        <td data-order="[% issue.returndate | html %]">
210
                        <td data-order="[% checkout.returndate | html %]">
200
                            <span class="tdlabel">Check-in date:</span>
211
                            <span class="tdlabel">Check-in date:</span>
201
                            [% issue.returndate | $KohaDates %]
212
                            [% checkout.returndate | $KohaDates %]
213
                        </td>
202
                    [% ELSE %]
214
                    [% ELSE %]
203
                        <td data-order="Checked out">
215
                        <td data-order="Checked out">
204
                            <em>(Checked out)</em>
216
                            <em>(Checked out)</em>
217
                        </td>
205
                    [% END %]
218
                    [% END %]
206
                    </td>
219
                    [% IF Koha.Preference('OPACMySummaryHTML') %]
207
                    [% IF OPACMySummaryHTML %]
220
                        <td>[% biblio.opac_summary_html | $raw %]</td>
208
                        <td>[% issue.MySummaryHTML | $raw %]</td>
209
                    [% END %]
221
                    [% END %]
210
                    <td></td>
222
                    <td></td>
211
                </tr>
223
                </tr>
212
            [% END # / FOREACH issue %]
224
            [% END # / FOREACH checkout %]
213
        </tbody>
225
        </tbody>
214
    </table>
226
    </table>
215
[% END %]
227
[% END %]
(-)a/opac/opac-readingrecord.pl (-71 / +28 lines)
Lines 21-43 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
    GetNormalizedOCLCNumber
29
);
30
use C4::Biblio;
24
use C4::Biblio;
31
use C4::Members qw( GetAllIssues );
32
use C4::External::BakerTaylor qw( image_url link_url );
25
use C4::External::BakerTaylor qw( image_url link_url );
33
use MARC::Record;
26
use MARC::Record;
34
27
35
use C4::Output qw( output_html_with_http_headers );
28
use C4::Output qw( output_html_with_http_headers );
36
use C4::Charset qw( StripNonXmlChars );
37
use Koha::Patrons;
29
use Koha::Patrons;
38
30
39
use Koha::ItemTypes;
31
use Koha::ItemTypes;
40
use Koha::Ratings;
41
32
42
my $query = CGI->new;
33
my $query = CGI->new;
43
34
Lines 55-61 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
55
    }
46
    }
56
);
47
);
57
48
58
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);
59
55
60
# get the record
56
# get the record
61
my $order = $query->param('order') || '';
57
my $order = $query->param('order') || '';
Lines 75-138 my $limit = $query->param('limit'); Link Here
75
$limit //= '';
71
$limit //= '';
76
$limit = ( $limit eq 'full' ) ? 0 : 50;
72
$limit = ( $limit eq 'full' ) ? 0 : 50;
77
73
78
my $issues = GetAllIssues( $borrowernumber, $order, $limit );
74
my $checkouts = [
79
75
    $patron->checkouts(
80
my $itype_attribute =
76
        {},
81
  ( C4::Context->preference('item-level_itypes') ) ? 'itype' : 'itemtype';
77
        {
82
78
            order_by => $order,
83
my $opac_summary_html = C4::Context->preference('OPACMySummaryHTML');
79
            prefetch => { item => { biblio => 'biblioitems' } },
84
foreach my $issue ( @{$issues} ) {
80
            ( $limit ? ( limit => $limit ) : () ),
85
    $issue->{normalized_isbn} = GetNormalizedISBN( $issue->{isbn} );
86
    if ( $issue->{$itype_attribute} ) {
87
        $issue->{translated_description} =
88
          $itemtypes->{ $issue->{$itype_attribute} }->{translated_description};
89
        $issue->{imageurl} =
90
          getitemtypeimagelocation( 'opac',
91
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
92
    }
93
94
    if (   C4::Context->preference('BakerTaylorEnabled')
95
        || C4::Context->preference('SyndeticsEnabled')
96
        || C4::Context->preference('SyndeticsCoverImages') )
97
    {
98
        my $marcxml = C4::Biblio::GetXmlBiblio( $issue->{biblionumber} );
99
        if ( $marcxml ) {
100
            $marcxml = StripNonXmlChars( $marcxml );
101
            my $marc_rec =
102
              MARC::Record::new_from_xml( $marcxml, 'UTF-8',
103
                C4::Context->preference('marcflavour') );
104
            $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') );
105
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber($marc_rec, C4::Context->preference('marcflavour'));
106
        }
81
        }
107
82
    )->as_list
108
    }
83
];
109
    # My Summary HTML
84
$limit -= scalar(@$checkouts) if $limit;
110
    if ($opac_summary_html) {
85
my $old_checkouts = [
111
        my $my_summary_html = $opac_summary_html;
86
    $patron->old_checkouts(
112
        $issue->{author}
87
        {},
113
          ? $my_summary_html =~ s/{AUTHOR}/$issue->{author}/g
88
        {
114
          : $my_summary_html =~ s/{AUTHOR}//g;
89
            order_by => $order,
115
        my $title = $issue->{title};
90
            prefetch => { item => { biblio => 'biblioitems' } },
116
        $title =~ s/\/+$//;    # remove trailing slash
91
            ( $limit ? ( limit => $limit ) : () ),
117
        $title =~ s/\s+$//;    # remove trailing space
92
        }
118
        $title
93
    )->as_list
119
          ? $my_summary_html =~ s/{TITLE}/$title/g
94
];
120
          : $my_summary_html =~ s/{TITLE}//g;
121
        $issue->{normalized_isbn}
122
          ? $my_summary_html =~ s/{ISBN}/$issue->{normalized_isbn}/g
123
          : $my_summary_html =~ s/{ISBN}//g;
124
        $issue->{biblionumber}
125
          ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g
126
          : $my_summary_html =~ s/{BIBLIONUMBER}//g;
127
        $issue->{MySummaryHTML} = $my_summary_html;
128
    }
129
    # Star ratings
130
    if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
131
        my $ratings = Koha::Ratings->search({ biblionumber => $issue->{biblionumber} });
132
        $issue->{ratings} = $ratings;
133
        $issue->{my_rating} = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef;
134
    }
135
}
136
95
137
if (C4::Context->preference('BakerTaylorEnabled')) {
96
if (C4::Context->preference('BakerTaylorEnabled')) {
138
	$template->param(
97
	$template->param(
Lines 152-166 for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above Link Here
152
111
153
my $saving_display = C4::Context->preference('OPACShowSavings');
112
my $saving_display = C4::Context->preference('OPACShowSavings');
154
if ( $saving_display =~ /checkouthistory/ ) {
113
if ( $saving_display =~ /checkouthistory/ ) {
155
    my $patron = Koha::Patrons->find( $borrowernumber );
156
    $template->param( savings => $patron->get_savings );
114
    $template->param( savings => $patron->get_savings );
157
}
115
}
158
116
159
$template->param(
117
$template->param(
160
    READING_RECORD => $issues,
118
    checkouts => $checkouts,
119
    old_checkouts => $old_checkouts,
161
    limit          => $limit,
120
    limit          => $limit,
162
    readingrecview => 1,
121
    readingrecview => 1,
163
    OPACMySummaryHTML => $opac_summary_html ? 1 : 0,
164
);
122
);
165
123
166
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 };
167
- 

Return to bug 33949