From 35b804b18de7614c7d79eef0383f56583e5751a7 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 11 Jul 2025 18:21:12 +0000 Subject: [PATCH] Bug 32432: Add SyndeticsAuthorNotes to staff interface --- catalogue/detail.pl | 33 +++++++++++++++++++ .../admin/preferences/enhanced_content.pref | 8 ++--- .../prog/en/modules/catalogue/detail.tt | 20 +++++++++++ opac/opac-detail.pl | 2 +- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index c6445d4a201..48bd77ec9da 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,31 @@ 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 ); + } + }; + warn $@ if $@; +} + +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 ); + }; + warn $@ if $@; +} + my @results = ( $dat, ); foreach ( keys %{$dat} ) { $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' ); 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..e165d917c0f 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: 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..c4655549980 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,7 @@ [% 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 %] [% INCLUDE 'cat-toolbar.inc' %] [% IF ( ocoins ) %] @@ -410,6 +411,12 @@ [% END %] [% END %] + [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %] + [% WRAPPER tab_item tabname= "anotes" %] + About the author + [% END %] + [% END %] + [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %] [% WRAPPER tab_item tabname= "${ plugins_intranet_catalog_biblio_tab.id }" %] [% plugins_intranet_catalog_biblio_tab.title | html %] @@ -961,6 +968,19 @@ [% END # /tab_panel %] [% END %] + [% IF ( SyndeticsAuthorNotes && SYNDETICS_ANOTES ) %] + [% WRAPPER tab_panel tabname="anotes" %] +
+

Author notes provided by Syndetics

+ [% FOREACH SYNDETICS_ANOTE IN SYNDETICS_ANOTES %] + [% IF ( SYNDETICS_ANOTE.content ) %] + [% SYNDETICS_ANOTE.content | $raw %] + [% END %] + [% END %] +
+ [% END # /tab_panel#anotes %] + [% END # / IF SyndeticsReviews && SYNDETICS_REVIEWS %] + [% 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..8e3e4523cd1 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -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