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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt (-41 / +53 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-194 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
                                                <th></th>
115
                                                <th></th>
116
                                            </tr>
116
                                            </tr>
117
                                        </thead>
117
                                        </thead>
118
                                        <tbody>
118
                                        <tbody>
119
                                            [% FOREACH issue IN READING_RECORD %]
119
                                            [% FOREACH checkout IN all_checkouts %]
120
                                                [% SET item = checkout.item %]
121
                                                [% SET biblio = item.biblio %]
120
                                                <tr>
122
                                                <tr>
121
                                                    <td style="display:none;">
123
                                                    <td style="display:none;">
122
                                                      [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' %]
124
                                                      [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' %]
123
                                                      [% ELSE %][% issuetype = 'standard_checkout' %]
125
                                                      [% ELSE %][% issuetype = 'standard_checkout' %]
124
                                                      [% END %]
126
                                                      [% END %]
125
                                                      [% issuetype | html %]
127
                                                      [% issuetype | html %]
126
                                                    </td>
128
                                                    </td>
127
                                                <td>
129
                                                <td>
128
                                                    [% IF  OPACAmazonCoverImages %]
130
                                                    [% SET normalized_isbn = biblio.normalized_isbn %]
129
                                                        [% IF  issue.normalized_isbn %]
131
                                                    [% IF OPACAmazonCoverImages %]
130
                                                            <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>
132
                                                        [% IF normalized_isbn %]
133
                                                            <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>
131
                                                        [% ELSE %]
134
                                                        [% ELSE %]
132
                                                             <span class="no-image">No cover image available</span>
135
                                                             <span class="no-image">No cover image available</span>
133
                                                        [% END %]
136
                                                        [% END %]
134
                                                    [% END %]
137
                                                    [% END %]
135
138
136
                                                [% IF GoogleJackets %]
139
                                                    [% IF GoogleJackets %]
137
                                                    [% IF  issue.normalized_isbn %]
140
                                                        [% IF normalized_isbn %]
138
                                                        <div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
141
                                                            <div title="[% biblio.biblionumber |url %]" class="[% normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
139
                                                    [% ELSE %]
142
                                                        [% ELSE %]
140
                                                       <span class="no-image">No cover image available</span>
143
                                                           <span class="no-image">No cover image available</span>
144
                                                        [% END %]
141
                                                    [% END %]
145
                                                    [% END %]
142
                                                [% END %]
143
146
144
                                                [% IF BakerTaylorEnabled %]
147
                                                    [% IF BakerTaylorEnabled || SyndeticsEnabled && SyndeticsCoverImages %]
145
                                                    [% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) %]
148
                                                        [% SET normalized_upc = biblio.normalized_upc %]
146
                                                    [% IF ( bt_id ) %]
149
                                                    [% END %]
147
                                                       <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
150
                                                    [% IF BakerTaylorEnabled %]
148
                                                    [% ELSE %]
151
                                                        [% bt_id = ( normalized_upc || normalized_isbn ) %]
149
                                                       <span class="no-image">No cover image available</span>
152
                                                        [% IF ( bt_id ) %]
153
                                                           <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
154
                                                        [% ELSE %]
155
                                                           <span class="no-image">No cover image available</span>
156
                                                        [% END %]
150
                                                    [% END %]
157
                                                    [% END %]
151
                                                [% END %]
152
158
153
                                                [% IF SyndeticsEnabled && SyndeticsCoverImages %]
159
                                                    [% IF SyndeticsEnabled && SyndeticsCoverImages %]
154
                                                    <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" />
160
                                                        <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" />
155
                                                [% END %]
161
                                                    [% END %]
156
                                                </td>
162
                                                </td>
157
                                                <td>
163
                                                <td>
158
                                                [% INCLUDE 'biblio-title.inc' biblio=issue, link => 1 %]
164
                                                    [% INCLUDE 'biblio-title.inc' biblio=biblio, link => 1 %]
159
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
165
                                                    [% IF ( Koha.Preference( 'OpacStarRatings' ) == 'all' ) %]
160
                                                        [% INCLUDE 'user-star-ratings.inc' item=issue %]
166
                                                        [% SET ratings = {ratings => biblio.ratings, itemnumber => item.itemnumber, biblionumber => biblio.biblionumber, my_rating => biblio.ratings.search( borrowernumber => logged_in_user.borrowernumber ).next } %]
167
                                                        [% INCLUDE 'user-star-ratings.inc' item=ratings %]
161
                                                    [% END %]
168
                                                    [% END %]
162
                                                </td>
169
                                                </td>
163
                                                <td>[% issue.author | html %]</td>
170
                                                <td>[% biblio.author | html %]</td>
164
                                                <td>
171
                                                <td>
165
                                                [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
172
                                                    [% SET item_type = item_types.${item.effective_itemtype} %]
166
                                                    [% IF ( issue.imageurl ) %]
173
                                                    [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
167
                                                        <img src="[% issue.imageurl | html %]" alt="" />
174
                                                        [% SET image_location = item_type.image_location %]
175
                                                        [% IF image_location %]
176
                                                            <img src="[% image_location | html %]" alt="" />
177
                                                        [% END %]
168
                                                    [% END %]
178
                                                    [% END %]
169
                                                [% END %]
179
                                                    <span class="itypetext">
170
                                                <span class="itypetext"><span class="tdlabel">Item type:</span>
180
                                                        <span class="tdlabel">Item type:</span>
171
                                                [% issue.translated_description | html %]</span></td>
181
                                                        [% item_type.translated_description | html %]
182
                                                    </span>
183
                                                </td>
172
                                                <td>
184
                                                <td>
173
                                                <span class="tdlabel">Call number:</span>
185
                                                <span class="tdlabel">Call number:</span>
174
                                                [% issue.itemcallnumber | html %]
186
                                                    [% item.itemcallnumber | html %]
175
                                                </td>
187
                                                </td>
176
                                                <td>
188
                                                <td>
177
                                                    [% IF issue.enumchron %]
189
                                                    [% IF item.enumchron %]
178
                                                        [% issue.enumchron | html %]
190
                                                        [% item.enumchron | html %]
179
                                                    [% END %]
191
                                                    [% END %]
180
                                                </td>
192
                                                </td>
181
                                                [% IF issue.returndate %]
193
                                                [% IF checkout.returndate %]
182
                                                    <td data-order="[% issue.returndate | html %]">
194
                                                    <td data-order="[% checkout.returndate | html %]">
183
                                                        <span class="tdlabel">Check-in date:</span>
195
                                                        <span class="tdlabel">Check-in date:</span>
184
                                                        [% issue.returndate | $KohaDates %]
196
                                                        [% checkout.returndate | $KohaDates %]
185
                                                [% ELSE %]
197
                                                [% ELSE %]
186
                                                    <td data-order="Checked out">
198
                                                    <td data-order="Checked out">
187
                                                        <em>(Checked out)</em>
199
                                                        <em>(Checked out)</em>
188
                                                [% END %]
200
                                                [% END %]
189
                                                </td>
201
                                                </td>
190
                                                [% IF OPACMySummaryHTML %]
202
                                                [% IF Koha.Preference('OPACMySummaryHTML') %]
191
                                                    <td>[% issue.MySummaryHTML | $raw %]</td>
203
                                                    <td>[% biblio.opac_summary_html | $raw %]</td>
192
                                                [% END %]
204
                                                [% END %]
193
                                                <td></td>
205
                                                <td></td>
194
                                                </tr>
206
                                                </tr>
(-)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