Bugzilla – Attachment 184023 Details for
Bug 32432
Show Syndetics Unbound on the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32432: Add Syndetics Unbound to staff interface
Bug-32432-Add-Syndetics-Unbound-to-staff-interface.patch (text/plain), 17.70 KB, created by
Lucas Gass (lukeg)
on 2025-07-11 22:34:49 UTC
(
hide
)
Description:
Bug 32432: Add Syndetics Unbound to staff interface
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-07-11 22:34:49 UTC
Size:
17.70 KB
patch
obsolete
>From 83b01856f7836501603db753ec85e668e869a062 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 11 Jul 2025 18:19:30 +0000 >Subject: [PATCH] Bug 32432: Add Syndetics Unbound to staff interface > >--- > catalogue/detail.pl | 60 ++++++++++ > .../data/mysql/atomicupdate/bug_32432.pl | 107 ++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 6 +- > .../admin/preferences/enhanced_content.pref | 32 +++--- > .../prog/en/modules/catalogue/detail.tt | 82 ++++++++++++++ > opac/opac-detail.pl | 6 +- > 6 files changed, 271 insertions(+), 22 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_32432.pl > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index c6445d4a201..d8900f0e8bd 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -60,6 +60,14 @@ use Koha::Reviews; > use Koha::SearchEngine::Search; > use Koha::SearchEngine::QueryBuilder; > use Koha::Serial::Items; >+use C4::External::Syndetics qw( >+ get_syndetics_anotes >+ get_syndetics_excerpt >+ get_syndetics_index >+ get_syndetics_reviews >+ get_syndetics_summary >+ get_syndetics_toc >+); > > my $query = CGI->new(); > >@@ -427,6 +435,58 @@ if ( C4::Context->preference('OPACComments') ) { > > } > >+my $syndetics_elements; >+ >+if ( C4::Context->preference("SyndeticsEnabled") ) { >+ $template->param( "SyndeticsEnabled" => 1 ); >+ $template->param( "SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode") ); >+ eval { >+ $syndetics_elements = &get_syndetics_index( $isbn, $upc, $oclc ); >+ for my $element ( values %$syndetics_elements ) { >+ $template->param( "Syndetics$element" . "Exists" => 1 ); >+ } >+ }; >+} >+ >+if ( C4::Context->preference("SyndeticsEnabled") >+ && C4::Context->preference("SyndeticsTOC") >+ && exists( $syndetics_elements->{'TOC'} ) ) >+{ >+ eval { >+ my $syndetics_toc = &get_syndetics_toc( $isbn, $upc, $oclc ); >+ $template->param( SYNDETICS_TOC => $syndetics_toc ); >+ }; >+} >+ >+if ( C4::Context->preference("SyndeticsEnabled") >+ && C4::Context->preference("SyndeticsExcerpt") >+ && exists( $syndetics_elements->{'DBCHAPTER'} ) ) >+{ >+ eval { >+ my $syndetics_excerpt = &get_syndetics_excerpt( $isbn, $upc, $oclc ); >+ $template->param( SYNDETICS_EXCERPT => $syndetics_excerpt ); >+ }; >+} >+ >+if ( C4::Context->preference("SyndeticsEnabled") >+ && C4::Context->preference("SyndeticsAuthorNotes") >+ && exists( $syndetics_elements->{'ANOTES'} ) ) >+{ >+ eval { >+ my $syndetics_anotes = &get_syndetics_anotes( $isbn, $upc, $oclc ); >+ $template->param( SYNDETICS_ANOTES => $syndetics_anotes ); >+ }; >+} >+ >+if ( C4::Context->preference("SyndeticsEnabled") >+ && C4::Context->preference("SyndeticsReviews") ) >+{ >+ eval { >+ my $syndetics_reviews = &get_syndetics_reviews( $isbn, $upc, $oclc, $syndetics_elements ); >+ $template->param( SYNDETICS_REVIEWS => $syndetics_reviews ); >+ }; >+} >+ > my @results = ( $dat, ); > foreach ( keys %{$dat} ) { > $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' ); >diff --git a/installer/data/mysql/atomicupdate/bug_32432.pl b/installer/data/mysql/atomicupdate/bug_32432.pl >new file mode 100755 >index 00000000000..b0f0e221237 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_32432.pl >@@ -0,0 +1,107 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "32432", >+ description => "Convert the Syndetics from 1/0 to multiple", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ my ($SyndeticsExcerpt) = $dbh->selectrow_array( >+ q{ >+ SELECT CASE >+ WHEN value = '1' THEN 'opac' >+ WHEN value = '0' THEN '' >+ ELSE value >+ END >+ FROM systempreferences >+ WHERE variable = 'SyndeticsExcerpt' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ UPDATE systempreferences >+ SET type = 'multiple', >+ options = 'staff|opac', >+ value = ? >+ WHERE variable = 'SyndeticsExcerpt' >+ }, undef, $SyndeticsExcerpt >+ ); >+ >+ say $out "Updated SyndeticsExcerpt system preference"; >+ >+ my ($SyndeticsReviews) = $dbh->selectrow_array( >+ q{ >+ SELECT CASE >+ WHEN value = '1' THEN 'opac' >+ WHEN value = '0' THEN '' >+ ELSE value >+ END >+ FROM systempreferences >+ WHERE variable = 'SyndeticsReviews' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ UPDATE systempreferences >+ SET type = 'multiple', >+ options = 'staff|opac', >+ value = ? >+ WHERE variable = 'SyndeticsReviews' >+ }, undef, $SyndeticsReviews >+ ); >+ >+ say $out "Updated SyndeticsReviews system preference"; >+ >+ my ($SyndeticsAuthorNotes) = $dbh->selectrow_array( >+ q{ >+ SELECT CASE >+ WHEN value = '1' THEN 'opac' >+ WHEN value = '0' THEN '' >+ ELSE value >+ END >+ FROM systempreferences >+ WHERE variable = 'SyndeticsAuthorNotes' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ UPDATE systempreferences >+ SET type = 'multiple', >+ options = 'staff|opac', >+ value = ? >+ WHERE variable = 'SyndeticsAuthorNotes' >+ }, undef, $SyndeticsAuthorNotes >+ ); >+ >+ say $out "Updated SyndeticsAuthorNotes system preference"; >+ >+ my ($SyndeticsTOC) = $dbh->selectrow_array( >+ q{ >+ SELECT CASE >+ WHEN value = '1' THEN 'opac' >+ WHEN value = '0' THEN '' >+ ELSE value >+ END >+ FROM systempreferences >+ WHERE variable = 'SyndeticsTOC' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ UPDATE systempreferences >+ SET type = 'multiple', >+ options = 'staff|opac', >+ value = ? >+ WHERE variable = 'SyndeticsTOC' >+ }, undef, $SyndeticsTOC >+ ); >+ >+ say $out "Updated SyndeticsTOC system preference"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index f2b6d940cc0..2b6a24e8bd0 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -793,15 +793,15 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('SuspensionsCalendar','noSuspensionsWhenClosed','ignoreCalendar|noSuspensionsWhenClosed','Specify whether to use the Calendar in calculating suspension expiration','Choice'), > ('SvcMaxReportRows','10',NULL,'Maximum number of rows to return via the report web service.','Integer'), > ('SwitchOnSiteCheckouts','0',NULL,'Automatically switch an on-site checkout to a normal checkout','YesNo'), >-('SyndeticsAuthorNotes','0','','Display Notes about the Author on OPAC from Syndetics','YesNo'), >+('SyndeticsAuthorNotes','','staff|opac','Display Notes about the Author from Syndetics','multiple'), > ('SyndeticsAwards','0','','Display Awards on OPAC from Syndetics','YesNo'), > ('SyndeticsClientCode','0','','Client Code for using Syndetics Solutions content','free'), > ('SyndeticsCoverImages','0','','Display Cover Images from Syndetics','YesNo'), > ('SyndeticsCoverImageSize','MC','MC|LC','Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','Choice'), > ('SyndeticsEditions','0','','Display Editions from Syndetics','YesNo'), > ('SyndeticsEnabled','0','','Turn on Syndetics Enhanced Content','YesNo'), >-('SyndeticsExcerpt','0','','Display Excerpts and first chapters on OPAC from Syndetics','YesNo'), >-('SyndeticsReviews','0','','Display Reviews on OPAC from Syndetics','YesNo'), >+('SyndeticsExcerpt','staff|opac','','Display Excerpts and first chapters from Syndetics','multiple'), >+('SyndeticsReviews','staff|opac','','Display Reviews on OPAC from Syndetics','multiple'), > ('SyndeticsSeries','0','','Display Series information on OPAC from Syndetics','YesNo'), > ('SyndeticsSummary','0','','Display Summary Information from Syndetics','YesNo'), > ('SyndeticsTOC','0','','Display Table of Content information from Syndetics','YesNo'), >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..91f4b12d3d1 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 >@@ -195,11 +195,11 @@ Enhanced content: > LC: large > - size. > - >+ - Show notes about the author of a title from Syndetics on item detail pages on the > - pref: SyndeticsAuthorNotes >- choices: >- 1: Show >- 0: "Don't show" >- - notes about the author of a title from Syndetics on item detail pages on the OPAC. >+ multiple: >+ opac: OPAC >+ staff: Staff interface > - > - pref: SyndeticsAwards > choices: >@@ -213,17 +213,17 @@ Enhanced content: > 0: "Don't show" > - information about other editions of a title from Syndetics on item detail pages on the OPAC (when <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFRBRizeEditions">OPACFRBRizeEditions</a> is on). > - >+ - Show excerpts from of a title from Syndetics on item detail pages on the > - pref: SyndeticsExcerpt >- choices: >- 1: Show >- 0: "Don't show" >- - excerpts from of a title from Syndetics on item detail pages on the OPAC. >+ multiple: >+ opac: OPAC >+ staff: Staff interface > - >+ - Show reviews of a title from Syndetics on item detail pages on the > - pref: SyndeticsReviews >- choices: >- 1: Show >- 0: "Don't show" >- - reviews of a title from Syndetics on item detail pages on the OPAC. >+ multiple: >+ opac: OPAC >+ staff: Staff interface > - > - pref: SyndeticsSeries > choices: >@@ -237,11 +237,11 @@ Enhanced content: > 0: "Don't show" > - a summary of a title from Syndetics on item detail pages on the OPAC. > - >+ - Show the table of contents of a title from Syndetics on item detail pages on the > - pref: SyndeticsTOC >- choices: >- 1: Show >- 0: "Don't show" >- - the table of contents of a title from Syndetics on item detail pages on the OPAC. >+ multiple: >+ opac: OPAC >+ staff: Staff interface > Tagging: > - > - pref: TagsEnabled >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 0fc818512a5..9c83b416ce5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -90,6 +90,10 @@ > [% CoceProviders = Koha.Preference('CoceProviders') %] > [% CoceHost = Koha.Preference('CoceHost') %] > [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %] >+ [% SyndeticsAuthorNotes = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsAuthorNotes').split(',').grep('staff').size %] >+ [% SyndeticsReviews = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsReviews').split(',').grep('staff').size %] >+ [% SyndeticsExcerpt = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsExcerpt').split(',').grep('staff').size %] >+ [% SyndeticsTOC = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsTOC').split(',').grep('staff').size %] > > [% INCLUDE 'cat-toolbar.inc' %] > [% IF ( ocoins ) %] >@@ -410,6 +414,30 @@ > [% END %] > [% END %] > >+ [% IF ( SyndeticsTOC && SYNDETICS_TOC ) %] >+ [% WRAPPER tab_item tabname= "toc" %] >+ <span>TOC</span> >+ [% END %] >+ [% END %] >+ >+ [% IF ( SyndeticsExcerpt && SYNDETICS_EXCERPT ) %] >+ [% WRAPPER tab_item tabname= "excerpt" %] >+ <span>Excerpt</span> >+ [% END %] >+ [% END %] >+ >+ [% IF ( SyndeticsReviews && SYNDETICS_REVIEWS ) %] >+ [% WRAPPER tab_item tabname= "reviews" %] >+ <span>Reviews</span> >+ [% END %] >+ [% END %] >+ >+ [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %] >+ [% WRAPPER tab_item tabname= "anotes" %] >+ <span>About the author</span> >+ [% END %] >+ [% END %] >+ > [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %] > [% WRAPPER tab_item tabname= "${ plugins_intranet_catalog_biblio_tab.id }" %] > <span>[% plugins_intranet_catalog_biblio_tab.title | html %]</span> >@@ -961,6 +989,60 @@ > [% END # /tab_panel %] > [% END %] > >+ [% IF ( SyndeticsTOC && SYNDETICS_TOC ) %] >+ [% WRAPPER tab_panel tabname="toc" %] >+ <div class="content_set"> >+ <h2>Table of contents provided by Syndetics</h2> >+ <ul> >+ [% FOREACH SYNDETICS_TO IN SYNDETICS_TOC %] >+ <li><strong>[% SYNDETICS_TO.l | html %] [% SYNDETICS_TO.t | html %]</strong>[% IF ( SYNDETICS_TO.p ) %]([% SYNDETICS_TO.p | $raw %])[% END %]</li> >+ [% END %] >+ </ul> >+ </div> >+ [% END # /tab_panel#toc %] >+ [% END %] >+ >+ [% IF ( SyndeticsExcerpt && SYNDETICS_EXCERPT ) %] >+ [% WRAPPER tab_panel tabname="excerpt" %] >+ <div class="content_set"> >+ <h2>Excerpt provided by Syndetics</h2> >+ [% SYNDETICS_EXCERPT | $raw %] >+ </div> >+ [% END # /tab_panel#excerpt %] >+ [% END # / IF SyndeticsExcerpt && SYNDETICS_EXCERPT %] >+ >+ [% IF ( SyndeticsReviews && SYNDETICS_REVIEWS ) %] >+ [% WRAPPER tab_panel tabname="reviews" %] >+ <div class="content_set"> >+ <h2>Reviews provided by Syndetics</h2> >+ [% FOREACH SYNDETICS_REVIEW IN SYNDETICS_REVIEWS %] >+ [% IF ( SYNDETICS_REVIEW.title ) %] >+ <h3>[% SYNDETICS_REVIEW.title | html %]</h3> >+ [% FOREACH review IN SYNDETICS_REVIEW.reviews %] >+ >+ [% IF ( review.content ) %] >+ [% review.content | $raw %] >+ [% END %] >+ [% END %] >+ [% END %] >+ [% END %] >+ </div> >+ [% END # /tab_panel#reviews %] >+ [% END # / IF SyndeticsReviews && SYNDETICS_REVIEWS %] >+ >+ [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %] >+ [% WRAPPER tab_panel tabname="anotes" %] >+ <div class="content_set"> >+ <h2>Author notes provided by Syndetics</h2> >+ [% FOREACH SYNDETICS_ANOTE IN SYNDETICS_ANOTES %] >+ [% IF ( SYNDETICS_ANOTE.content ) %] >+ [% SYNDETICS_ANOTE.content | $raw %] >+ [% END %] >+ [% END %] >+ </div> >+ [% END # /tab_panel#anotes %] >+ [% END # / IF SyndeticsAuthorNotes && SYNDETICS_ANOTES %] >+ > [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %] > [% WRAPPER tab_panel tabname="${ plugins_intranet_catalog_biblio_tab.id }" %] > [% plugins_intranet_catalog_biblio_tab.content | $raw %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 9cd2364f849..8f0437f0a93 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -1074,7 +1074,7 @@ if ( C4::Context->preference("SyndeticsEnabled") > } > > if ( C4::Context->preference("SyndeticsEnabled") >- && C4::Context->preference("SyndeticsExcerpt") >+ && C4::Context->preference("SyndeticsExcerpt") =~ /opac/ > && exists( $syndetics_elements->{'DBCHAPTER'} ) ) > { > eval { >@@ -1085,7 +1085,7 @@ if ( C4::Context->preference("SyndeticsEnabled") > } > > if ( C4::Context->preference("SyndeticsEnabled") >- && C4::Context->preference("SyndeticsReviews") ) >+ && C4::Context->preference("SyndeticsReviews") =~ /opac/ ) > { > eval { > my $syndetics_reviews = &get_syndetics_reviews( $isbn, $upc, $oclc, $syndetics_elements ); >@@ -1095,7 +1095,7 @@ if ( C4::Context->preference("SyndeticsEnabled") > } > > if ( C4::Context->preference("SyndeticsEnabled") >- && C4::Context->preference("SyndeticsAuthorNotes") >+ && C4::Context->preference("SyndeticsAuthorNotes") =~ /opac/ > && exists( $syndetics_elements->{'ANOTES'} ) ) > { > eval { >-- >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 32432
:
184018
|
184019
|
184020
|
184022
|
184023
|
184024
|
184177
|
184178