Bugzilla – Attachment 170686 Details for
Bug 37463
Include cover images from Amazon on staff interface check out screen for specific patron categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug-37463-Show-Amazon-cover-images-in-checkouts-ta.patch (text/plain), 6.83 KB, created by
Roman Dolny
on 2024-08-23 22:01:49 UTC
(
hide
)
Description:
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2024-08-23 22:01:49 UTC
Size:
6.83 KB
patch
obsolete
>From a9ee3c97ede84012dd8c13826bfa34e3d2808367 Mon Sep 17 00:00:00 2001 >From: danyonsewell <danyonsewell@catalyst.net.nz> >Date: Tue, 20 Aug 2024 05:11:45 +0000 >Subject: [PATCH] Bug 37463: Show Amazon cover images in checkouts table for > selected patron categories > >This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now. > >Test plan: >Step 1 - apply this patch >Step 2 - Make sure AmazonCoverImages syspref is set to "show" >step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is) >step 4 - checkout an item to your patron account >step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > ...ug_37463-add_CoverImagesCategories_syspref.pl | 16 ++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../modules/admin/preferences/circulation.pref | 5 +++++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 8 ++++++++ > svc/checkouts | 16 ++++++++++++++-- > 5 files changed, 44 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl b/installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl >new file mode 100755 >index 0000000000..0ab6e4d78b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "37463", >+ description => "Add new system preference CoverImagesCategories", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ 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')} >+ ); >+ >+ say $out "Added system preference 'CoverImagesCategories'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 1a7cd033e9..99561ee36f 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -175,6 +175,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'), > ('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'), > ('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'), >+('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'), > ('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'), > ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'), > ('CSVDelimiter',',',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 76983576a6..2951e64b4d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -1284,6 +1284,11 @@ Circulation: > - pref: SelfCheckAllowByIPRanges > class: short > - (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>.) >+ - >+ - "Cover images will show in the patron checkouts table for selected patron categories. Please note: this only currently works for Amazon cover images" >+ - pref: CoverImagesCategories >+ choices: patron-categories >+ class: multiple > - > - "Patron categories allowed to check out in a batch while logged into the self checkout system:" > - pref: SCOBatchCheckoutsValidCategories >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index a2b540e971..52e81275ea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -145,6 +145,14 @@ function LoadIssuesTable() { > + "</a>" > + onsite_checkout > >+ if (oObj.showcoverimage == 1 ) { >+ title += '<div class="cover-image" id="amazon-bookcoverimg" style="display: block;">' >+ + '<a href="https://images-na.ssl-images-amazon.com/images/P/' >+ + oObj.isbn >+ + '.01.LZZZZZZZ.jpg" title="Amazon cover image"><img src="https://images-na.ssl-images-amazon.com/images/P/' >+ + oObj.isbn >+ + '.01.MZZZZZZZ.jpg" alt="Amazon cover image"/></a><div class="hint">Image from Amazon.com</div></div>'; >+ } > return title; > }, > "type": "anti-the" >diff --git a/svc/checkouts b/svc/checkouts >index 4c2ce32609..c2720606fe 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -239,6 +239,16 @@ while ( my $c = $sth->fetchrow_hashref() ) { > } > } > >+ my @coverimagescategories = split( ",", C4::Context->preference("CoverImagesCategories") ); >+ my $showcoverimage = 0; >+ my $patroncategory = Koha::Patrons->find( $c->{borrowernumber} )->categorycode; >+ if ( grep( /^$patroncategory$/, @coverimagescategories ) ) { >+ $showcoverimage = 1; >+ } >+ >+ my $biblio = Koha::Biblios->find( $c->{biblionumber} ); >+ my $isbn = $biblio->normalized_isbn; >+ > my $checkout = { > DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, > title => $c->{title}, >@@ -303,8 +313,10 @@ while ( my $c = $sth->fetchrow_hashref() ) { > firstname => $c->{firstname}, > cardnumber => $c->{cardnumber}, > }, >- issued_today => !$c->{not_issued_today}, >- recalled => $recalled, >+ issued_today => !$c->{not_issued_today}, >+ recalled => $recalled, >+ isbn => $isbn, >+ showcoverimage => $showcoverimage, > }; > > if ( $c->{not_issued_today} ) { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37463
:
169807
|
169808
|
169809
|
169852
|
170492
|
170623
| 170686