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

(-)a/installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "37463",
5
    description => "Add new system preference CoverImagesCategories",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('CoverImagesCategories', '', NULL, 'Cover images will show in the patron checkouts table for selected patron categories. Please note: this only currently works for Amazon cover images.:', 'Free')}
12
        );
13
14
        say $out "Added system preference 'CoverImagesCategories'";
15
    },
16
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 177-182 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
177
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
177
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
178
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
178
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
179
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
179
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
180
('CoverImagesCategories', '', NULL, 'Cover images will show in the patron checkouts table for selected patron categories. Please note: this only currently works for Amazon cover images', 'Free'),
180
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
181
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
181
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
182
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
182
('CSVDelimiter',',',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
183
('CSVDelimiter',',',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+5 lines)
Lines 1307-1312 Circulation: Link Here
1307
            - pref: SelfCheckAllowByIPRanges
1307
            - pref: SelfCheckAllowByIPRanges
1308
              class: short
1308
              class: short
1309
            - (Leave blank if not used. Use ranges or simple IP addresses separated by spaces, like <code>192.168.1.1 192.168.0.0/24</code>.)
1309
            - (Leave blank if not used. Use ranges or simple IP addresses separated by spaces, like <code>192.168.1.1 192.168.0.0/24</code>.)
1310
        -
1311
            - "Cover images will show in the patron checkouts table for selected patron categories. Please note: this only currently works for Amazon cover images"
1312
            - pref: CoverImagesCategories
1313
              choices: patron-categories
1314
              class: multiple
1310
        -
1315
        -
1311
            - "Patron categories allowed to check out in a batch while logged into the self checkout system:"
1316
            - "Patron categories allowed to check out in a batch while logged into the self checkout system:"
1312
            - pref: SCOBatchCheckoutsValidCategories
1317
            - pref: SCOBatchCheckoutsValidCategories
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (+20 lines)
Lines 165-170 function LoadIssuesTable() { Link Here
165
                          + "</a>"
165
                          + "</a>"
166
                          + onsite_checkout
166
                          + onsite_checkout
167
167
168
                          if (oObj.showcoverimage == 1 ) {
169
                              var amazonurl = 'https://images-na.ssl-images-amazon.com/images/P/' + oObj.isbn + '.01.MZZZZZZZ.jpg';
170
                              var img = new Image();
171
                              img.src = amazonurl;
172
                              var w = img.width;
173
                              var h = img.height;
174
                              if (w == 1 && h == 1) {
175
                                  /* Amazon returned single-pixel placeholder */
176
                              }
177
                              else {
178
                                  title += '<div id="amazon-bookcoverimg-'
179
                                    + oObj.biblionumber
180
                                    + '" class="cover-image amazon-bookcoverimg" style="display: block;">'
181
                                    + '<a href="https://images-na.ssl-images-amazon.com/images/P/'
182
                                    + oObj.isbn
183
                                    + '.01.LZZZZZZZ.jpg" title="Amazon cover image"><img src='
184
                                    + amazonurl
185
                                    + 'alt="Amazon cover image"/></a><div class="hint">Image from Amazon.com</div></div>';
186
                              }
187
                          }
168
                    return title;
188
                    return title;
169
                },
189
                },
170
                "type":  "anti-the"
190
                "type":  "anti-the"
(-)a/svc/checkouts (-3 / +14 lines)
Lines 240-245 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
240
        }
240
        }
241
    }
241
    }
242
242
243
    my @coverimagescategories = split( ",", C4::Context->preference("CoverImagesCategories") );
244
    my $showcoverimage        = 0;
245
    my $patroncategory        = Koha::Patrons->find( $c->{borrowernumber} )->categorycode;
246
    if ( grep( /^$patroncategory$/, @coverimagescategories ) ) {
247
        $showcoverimage = 1;
248
    }
249
250
    my $biblio = Koha::Biblios->find( $c->{biblionumber} );
251
    my $isbn   = $biblio->normalized_isbn;
252
243
    my $checkout = {
253
    my $checkout = {
244
        DT_RowId               => $c->{itemnumber} . '-' . $c->{borrowernumber},
254
        DT_RowId               => $c->{itemnumber} . '-' . $c->{borrowernumber},
245
        title                  => $c->{title},
255
        title                  => $c->{title},
Lines 305-312 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
305
            firstname  => $c->{firstname},
315
            firstname  => $c->{firstname},
306
            cardnumber => $c->{cardnumber},
316
            cardnumber => $c->{cardnumber},
307
        },
317
        },
308
        issued_today => !$c->{not_issued_today},
318
        issued_today   => !$c->{not_issued_today},
309
        recalled     => $recalled,
319
        recalled       => $recalled,
320
        isbn           => $isbn,
321
        showcoverimage => $showcoverimage,
310
    };
322
    };
311
323
312
    if ( $c->{not_issued_today} ) {
324
    if ( $c->{not_issued_today} ) {
313
- 

Return to bug 37463