Bugzilla – Attachment 180719 Details for
Bug 28307
Enable BakerTaylorEnabled content in the staff interface with separate system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28307: Make BakerTaylorEnabled preference separate for staff and OPAC
Bug-28307-Make-BakerTaylorEnabled-preference-separ.patch (text/plain), 15.66 KB, created by
Owen Leonard
on 2025-04-08 13:33:42 UTC
(
hide
)
Description:
Bug 28307: Make BakerTaylorEnabled preference separate for staff and OPAC
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-04-08 13:33:42 UTC
Size:
15.66 KB
patch
obsolete
>From 2de05736643d32caa55215d741f5d4b9e725364b Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 10 May 2021 15:30:51 +0000 >Subject: [PATCH] Bug 28307: Make BakerTaylorEnabled preference separate for > staff and OPAC > >This patch updates the system preferences controlling Baker & Taylor >content so that there are separate preferences for the OPAC and the >staff interface. The patch also adds Baker & Taylor cover images to the >staff client. > >To test, apply the patch and run the database update. > >- Go to Admnistration -> System preferences -> Enhanced content >- You should see a BakerTaylorEnabled and a OPACBakerTaylorEnabled > preference. The OPACBakerTaylorEnabled should have the same setting > you previously had for BakerTaylorEnabled. The BakerTaylorEnabled > preference should be turned off. > - Note that the description of the preferences have been updated to > include links to the Baker & Taylor username and password > preferences. >- Enable both and make sure you have a valid Baker & Taylor username > and password entered. >- Perform a search in both the OPAC and staff interface. A Baker & > Taylor cover image should appear on the bibliographic detail page in > the OPAC, and on the search results and bibliographic detail page in > the staff interface. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > catalogue/detail.pl | 37 +++++++++++++++---- > .../bug-28307-BakerTaylorEnabled-staff.pl | 36 ++++++++++++++++++ > .../admin/preferences/enhanced_content.pref | 14 +++++-- > .../prog/en/modules/catalogue/detail.tt | 19 ++++++++++ > .../prog/en/modules/catalogue/results.tt | 17 +++++++++ > .../bootstrap/en/modules/opac-detail.tt | 2 +- > opac/opac-detail.pl | 4 +- > 7 files changed, 115 insertions(+), 14 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug-28307-BakerTaylorEnabled-staff.pl > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index d7d13b2f1dd..2de83b02b86 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -34,13 +34,14 @@ use C4::Output qw( output_html_with_http_headers ); > use C4::Biblio qw( GetBiblioData GetFrameworkCode ); > use C4::Items qw( GetAnalyticsCount ); > use C4::Reserves; >-use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); >-use C4::XISBN qw( get_xisbns ); >-use C4::External::Amazon qw( get_amazon_tld ); >-use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); >-use C4::Tags qw( get_tags ); >-use C4::XSLT qw( XSLTParse4Display ); >-use Koha::DateUtils qw( format_sqldatetime ); >+use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); >+use C4::XISBN qw( get_xisbns ); >+use C4::External::Amazon qw( get_amazon_tld ); >+use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); >+use C4::External::BakerTaylor qw( image_url link_url ); >+use C4::Tags qw( get_tags ); >+use C4::XSLT qw( XSLTParse4Display ); >+use Koha::DateUtils qw( format_sqldatetime ); > use C4::HTML5Media; > use C4::CourseReserves qw( GetItemCourseReservesInfo ); > use Koha::AuthorisedValues; >@@ -435,6 +436,28 @@ foreach ( keys %{$dat} ) { > # does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews'); > # method query not found?!?! > $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("AmazonCoverImages") ); >+ >+if ( C4::Context->preference("BakerTaylorEnabled") ) { >+ $template->param( >+ BakerTaylorEnabled => 1, >+ BakerTaylorImageURL => &image_url(), >+ BakerTaylorLinkURL => &link_url(), >+ BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'), >+ ); >+ my ( $bt_user, $bt_pass ); >+ if ( $isbn >+ and $bt_user = C4::Context->preference('BakerTaylorUsername') >+ and $bt_pass = C4::Context->preference('BakerTaylorPassword') ) >+ { >+ $template->param( >+ BakerTaylorContentURL => sprintf( >+ "https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", >+ $bt_user, $bt_pass, $isbn >+ ) >+ ); >+ } >+} >+ > $template->param( > biblionumber => $biblionumber, > ( $analyze ? 'analyze' : 'detailview' ) => 1, >diff --git a/installer/data/mysql/atomicupdate/bug-28307-BakerTaylorEnabled-staff.pl b/installer/data/mysql/atomicupdate/bug-28307-BakerTaylorEnabled-staff.pl >new file mode 100644 >index 00000000000..ec2dcb6abae >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-28307-BakerTaylorEnabled-staff.pl >@@ -0,0 +1,36 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_failure say_success say_info); >+ >+return { >+ bug_number => "28307", >+ description => "Make BakerTaylorEnabled preference separate for staff and OPAC", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Get any existing value from the IntranetmainUserblock system preference >+ my ($bakertaylorenabled) = $dbh->selectrow_array( >+ q| >+ SELECT value FROM systempreferences WHERE variable='BakerTaylorEnabled'; >+ | >+ ); >+ >+ $dbh->do("DELETE FROM systempreferences WHERE variable='BakerTaylorEnabled'"); >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( variable, value, explanation, options, type) VALUES ( 'OPACBakerTaylorEnabled', ?, 'Enable or disable all Baker & Taylor features in the OPAC', NULL, 'YesNo' ) >+ }, undef, $bakertaylorenabled >+ ); >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( variable, value, explanation, options, type) VALUES ( 'BakerTaylorEnabled', ?, 'Enable or disable all Baker & Taylor features in the staff interface', NULL, 'YesNo' ) >+ }, undef, $bakertaylorenabled >+ ); >+ >+ say_success( >+ $out, >+ "Added new system preference 'OPACBakerTaylorEnabled' to allow separate OPAC and staff interface settings" >+ ); >+ }, >+}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >index 1f088136f49..ddfc55ef7b4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >@@ -64,20 +64,26 @@ Enhanced content: > - pref: Babeltheque_url_update > class: url > - (e.g. http://www.babeltheque.com/.../file.csv.bz2). >- Baker and Taylor: >+ Baker & Taylor: > - > - pref: BakerTaylorEnabled > choices: > 1: Add > 0: "Don't add" >- - Baker and Taylor links and cover images to the OPAC and staff interface. This requires that you have entered in a username and password (which can be seen in image links). >+ - Baker & Taylor links and cover images to the staff interface. This requires that you have entered your <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BakerTaylorUsername">BakerTaylorUsername</a> and <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BakerTaylorPassword">BakerTaylorPassword</a> (which will be publicly visible in image links). >+ - >+ - pref: OPACBakerTaylorEnabled >+ choices: >+ 1: Add >+ 0: "Don't add" >+ - Baker & Taylor links and cover images to the OPAC. This requires that you have entered your <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BakerTaylorUsername">BakerTaylorUsername</a> and <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=BakerTaylorPassword">BakerTaylorPassword</a> (which will be publicly visible in image links). > - > - 'Baker and Taylor "My Library Bookstore" links should be accessed at <code>https://' > - pref: BakerTaylorBookstoreURL > class: url > - <em>isbn</em></code> (this should be filled in with something like <code>ocls.mylibrarybookstore.com/MLB/actions/searchHandler.do?nextPage=bookDetails&parentNum=10923&key=</code>). Leave it blank to disable these links. > - >- - Access Baker and Taylor using username >+ - Access Baker & Taylor using username > - pref: BakerTaylorUsername > class: password > - and password >@@ -432,4 +438,4 @@ Enhanced content: > pt_BR: Portuguese â Brazil > tr: Turkish > zh_TW: Chinese â Taiwan >- - It will be used as a fallback value if the language used by the interface does not have an online manual version. >+ - It will be used as a fallback value if the language used by the interface does not have an online manual version. >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 801f7dad1ea..348e1abf491 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -301,6 +301,23 @@ > [% END %] > [% END %] > >+ [% bt_id = ( normalized_upc || normalized_isbn ) %] >+ [% IF ( Koha.Preference('BakerTaylorEnabled') && bt_id ) %] >+ [% SET BakerTaylorImageURL = "https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=${ Koha.Preference('BakerTaylorUsername') }&Password=${ Koha.Preference('BakerTaylorPassword') }&Options=Y&Return=T&Type=S&Value=$bt_id" %] >+ <div class="cover-image" id="bakertaylor-coverimg"> >+ [% IF BakerTaylorBookstoreURL %] >+ <a href="https://[% Koha.Preference( BakerTaylorBookstoreURL ) | url %][% bt_id | url %]"> >+ <img alt="See Baker & Taylor" src=" [% BakerTaylorImageURL | url %]" /> >+ </a> >+ [% ELSE %] >+ <a href="[% BakerTaylorImageURL | url %]"> >+ <img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %]" /> >+ </a> >+ [% END %] >+ <div class="hint">Image from Baker & Taylor</div> >+ </div> >+ [% END %] >+ > [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %] > [% SET custom_cover_image_url = biblio.custom_cover_image_url %] > [% IF custom_cover_image_url %] >@@ -1484,6 +1501,8 @@ > } > div.find(".hint").html(coce_description); > lightbox_descriptions.push(coce_description); >+ } else if ( div.attr("id") == "bakertaylor-coverimg" ){ >+ lightbox_descriptions.push(_("Image from Baker & Taylor")); > } else if ( div.attr("class") == "cover-image local-coverimg" ) { > lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link'))); > } else { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index ade947fd89d..377d156ff99 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -634,6 +634,23 @@ > [% END %] > [% END %] > >+ [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] >+ [% IF ( Koha.Preference('BakerTaylorEnabled') && bt_id ) %] >+ [% SET BakerTaylorImageURL = "https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=${ Koha.Preference('BakerTaylorUsername') }&Password=${ Koha.Preference('BakerTaylorPassword') }&Options=Y&Return=T&Type=S&Value=$bt_id" %] >+ <div class="cover-image bakertaylor-coverimg" id="bakertaylor-coverimg"> >+ [% IF BakerTaylorBookstoreURL %] >+ <a href="https://[% Koha.Preference( BakerTaylorBookstoreURL ) | url %][% bt_id | url %]"> >+ <img alt="See Baker & Taylor" src=" [% BakerTaylorImageURL | url %]" /> >+ </a> >+ [% ELSE %] >+ <a href="[% BakerTaylorImageURL | url %]"> >+ <img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %]" /> >+ </a> >+ [% END %] >+ <div class="hint">Image from Baker & Taylor</div> >+ </div> >+ [% END %] >+ > [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %] > [% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %] > [% IF custom_cover_image_url %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index f87c37056a8..4851bb5290c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -129,7 +129,7 @@ > [% END %] > > [% bt_id = ( normalized_upc || normalized_isbn ) %] >- [% IF ( BakerTaylorEnabled && bt_id ) %] >+ [% IF ( OPACBakerTaylorEnabled && bt_id ) %] > <div class="cover-image" id="bakertaylor-coverimg"> > [% IF BakerTaylorBookstoreURL %] > <a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]"> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 9cd2364f849..443cd2ca238 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -1162,9 +1162,9 @@ if ( C4::Context->preference("OPACShelfBrowser") ) { > > $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("OPACAmazonCoverImages") ); > >-if ( C4::Context->preference("BakerTaylorEnabled") ) { >+if ( C4::Context->preference("OPACBakerTaylorEnabled") ) { > $template->param( >- BakerTaylorEnabled => 1, >+ OPACBakerTaylorEnabled => 1, > BakerTaylorImageURL => &image_url(), > BakerTaylorLinkURL => &link_url(), > BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'), >-- >2.39.5
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 28307
:
123198
|
125708
|
125743
|
125744
|
127222
|
127223
|
127224
|
127225
|
131784
|
131785
|
131786
|
133274
|
133275
|
133276
|
138137
|
138138
|
138139
|
142193
|
142194
|
142195
|
169061
|
169062
|
169063
|
175257
|
175258
|
175259
|
175265
|
178730
|
178731
|
178732
| 180719 |
180720
|
180721