Bugzilla – Attachment 170492 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: Adding system preference.
Bug-37463-Adding-system-preference.patch (text/plain), 7.78 KB, created by
Danyon Sewell
on 2024-08-20 05:16:05 UTC
(
hide
)
Description:
Bug 37463: Adding system preference.
Filename:
MIME Type:
Creator:
Danyon Sewell
Created:
2024-08-20 05:16:05 UTC
Size:
7.78 KB
patch
obsolete
>From 5c8dbe8d1868d2b55cdb405382066c59021f6331 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: Adding system preference. > >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 >--- > .../bug_37463-add_CoverImagesCategories_syspref.pl | 14 ++++++++++++++ > ...g_37463-add_SCOCoverImagesCategories_syspref.pl | 14 -------------- > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../en/modules/admin/preferences/circulation.pref | 4 ++-- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 8 ++++++++ > svc/checkouts | 12 ++++++++++++ > 6 files changed, 37 insertions(+), 17 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl > delete mode 100644 installer/data/mysql/atomicupdate/bug_37463-add_SCOCoverImagesCategories_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 100644 >index 0000000000..2de9719c1c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_37463-add_CoverImagesCategories_syspref.pl >@@ -0,0 +1,14 @@ >+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/atomicupdate/bug_37463-add_SCOCoverImagesCategories_syspref.pl b/installer/data/mysql/atomicupdate/bug_37463-add_SCOCoverImagesCategories_syspref.pl >deleted file mode 100644 >index 240fb80ae7..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_37463-add_SCOCoverImagesCategories_syspref.pl >+++ /dev/null >@@ -1,14 +0,0 @@ >-use Modern::Perl; >- >-return { >- bug_number => "37463", >- description => "Add new system preference SCOCoverImagesCategories", >- up => sub { >- my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >- >- $dbh->do(q{INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('SCOCoverImagesCategories', '', NULL, 'Cover images will show for checked out items in the self checkout module for selected patron categories:', 'Free')}); >- >- say $out "Added system preference 'SCOCoverImagesCategories'"; >- }, >-}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 1f7fc68999..93db6c339a 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -685,7 +685,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), > ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), > ('SCOBatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch while logged into Self Checkout','Free'), >-('SCOCoverImagesCategories', '', NULL, 'Cover images will show for checked out items in the self checkout module for selected patron categories:', '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'), > ('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'), > ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'), > ('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'), >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 214ccc6dc2..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 >@@ -1285,8 +1285,8 @@ Circulation: > 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 for checked out items in the self checkout module for selected patron categories:" >- - pref: SCOCoverImagesCategories >+ - "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 > - >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index a2b540e971..e2722d4e0a 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..61fe1f8f40 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}, >@@ -305,6 +315,8 @@ while ( my $c = $sth->fetchrow_hashref() ) { > }, > 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