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 183-188 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
183
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
183
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
184
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
184
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
185
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
185
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
186
('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'),
186
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
187
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
187
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
188
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
188
('CSVDelimiter',',',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'),
189
('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 1330-1335 Circulation: Link Here
1330
            - pref: SelfCheckAllowByIPRanges
1330
            - pref: SelfCheckAllowByIPRanges
1331
              class: short
1331
              class: short
1332
            - (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>.)
1332
            - (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>.)
1333
        -
1334
            - "Cover images will show in the patron checkouts table for selected patron categories. Please note: this only currently works for Amazon cover images"
1335
            - pref: CoverImagesCategories
1336
              choices: patron-categories
1337
              class: multiple
1333
        -
1338
        -
1334
            - "Patron categories allowed to check out in a batch while logged into the self-checkout system:"
1339
            - "Patron categories allowed to check out in a batch while logged into the self-checkout system:"
1335
            - pref: SCOBatchCheckoutsValidCategories
1340
            - pref: SCOBatchCheckoutsValidCategories
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (+21 lines)
Lines 242-247 function LoadIssuesTable() { Link Here
242
                            "</a>" +
242
                            "</a>" +
243
                            onsite_checkout;
243
                            onsite_checkout;
244
244
245
                            if (oObj.showcoverimage == 1 ) {
246
                                var amazonurl = 'https://images-na.ssl-images-amazon.com/images/P/' + oObj.isbn + '.01.MZZZZZZZ.jpg';
247
                                var img = new Image();
248
                                img.src = amazonurl;
249
                                var w = img.width;
250
                                var h = img.height;
251
                                if (w == 1 && h == 1) {
252
                                    /* Amazon returned single-pixel placeholder */
253
                                }
254
                                else {
255
                                    title +=
256
			                '<div id="amazon-bookcoverimg-' +
257
                                        oObj.biblionumber +
258
                                        '" class="cover-image amazon-bookcoverimg" style="display: block;">' +
259
                                        '<a href="https://images-na.ssl-images-amazon.com/images/P/' +
260
                                        oObj.isbn +
261
                                        '.01.LZZZZZZZ.jpg" title="Amazon cover image"><img src=' +
262
                                        amazonurl +
263
                                        'alt="Amazon cover image"/></a><div class="hint">Image from Amazon.com</div></div>';
264
                                }
265
                            }
245
                        return title;
266
                        return title;
246
                    },
267
                    },
247
                    type: "anti-the",
268
                    type: "anti-the",
(-)a/svc/checkouts (-3 / +14 lines)
Lines 241-246 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
241
        }
241
        }
242
    }
242
    }
243
243
244
    my @coverimagescategories = split( ",", C4::Context->preference("CoverImagesCategories") );
245
    my $showcoverimage        = 0;
246
    my $patroncategory        = Koha::Patrons->find( $c->{borrowernumber} )->categorycode;
247
    if ( grep( /^$patroncategory$/, @coverimagescategories ) ) {
248
        $showcoverimage = 1;
249
    }
250
251
    my $biblio = Koha::Biblios->find( $c->{biblionumber} );
252
    my $isbn   = $biblio->normalized_isbn;
253
244
    my $checkout = {
254
    my $checkout = {
245
        DT_RowId               => $c->{itemnumber} . '-' . $c->{borrowernumber},
255
        DT_RowId               => $c->{itemnumber} . '-' . $c->{borrowernumber},
246
        title                  => $c->{title},
256
        title                  => $c->{title},
Lines 306-313 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
306
            firstname  => $c->{firstname},
316
            firstname  => $c->{firstname},
307
            cardnumber => $c->{cardnumber},
317
            cardnumber => $c->{cardnumber},
308
        },
318
        },
309
        issued_today => !$c->{not_issued_today},
319
        issued_today   => !$c->{not_issued_today},
310
        recalled     => $recalled,
320
        recalled       => $recalled,
321
        isbn           => $isbn,
322
        showcoverimage => $showcoverimage,
311
    };
323
    };
312
324
313
    if ( $c->{not_issued_today} ) {
325
    if ( $c->{not_issued_today} ) {
314
- 

Return to bug 37463