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 261-266 function LoadIssuesTable() { Link Here
261
                            "</a>" +
261
                            "</a>" +
262
                            onsite_checkout;
262
                            onsite_checkout;
263
263
264
                            if (oObj.showcoverimage == 1 ) {
265
                                var amazonurl = 'https://images-na.ssl-images-amazon.com/images/P/' + oObj.isbn + '.01.MZZZZZZZ.jpg';
266
                                var img = new Image();
267
                                img.src = amazonurl;
268
                                var w = img.width;
269
                                var h = img.height;
270
                                if (w == 1 && h == 1) {
271
                                    /* Amazon returned single-pixel placeholder */
272
                                }
273
                                else {
274
                                    title +=
275
			                '<div id="amazon-bookcoverimg-' +
276
                                        oObj.biblionumber +
277
                                        '" class="cover-image amazon-bookcoverimg" style="display: block;">' +
278
                                        '<a href="https://images-na.ssl-images-amazon.com/images/P/' +
279
                                        oObj.isbn +
280
                                        '.01.LZZZZZZZ.jpg" title="Amazon cover image"><img src=' +
281
                                        amazonurl +
282
                                        'alt="Amazon cover image"/></a><div class="hint">Image from Amazon.com</div></div>';
283
                                }
284
                            }
264
                        return title;
285
                        return title;
265
                    },
286
                    },
266
                    type: "anti-the",
287
                    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