From aedb708a3e79b5688dd0d9c86d12977fc7c06457 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 9 Jun 2021 19:29:19 +0000 Subject: [PATCH] Bug 27734: Replace OpacHiddenRecordMessage system preference with HTML customization This patch replaces OpacHiddenRecordMessage preference with an HTML customization of the same name. Test plan: 1 - Apply patch 2 - Test OpacSupressionsRedirect and OpacSuppressionMessage prefs to ensure they work as before 3 - Set preference OpacHiddenRecordRedirect on and create HTML customization OpacHiddenRecordMessage 4 - Enable OpacHiddenItemsHidesRecord and hide a biblio using OpacHiddenItems: biblionumber: [303] 5 - Test OpacHiddenRecordRedirect and OpacHiddenRecordMessage to ensure they work as expected 6 - Hit the link: http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=303 7 - When OpacHiddenRecordRedirect set to 404 you get a 404 8 - When OpacHiddenRecordRedirect set to 'an explanatory page' you get 'opac-blocked.pl' 9 - If you set a message in OpacHiddenRecordMessage it displays on opac-blocked.pl --- installer/data/mysql/atomicupdate/bug_27734.perl | 7 ++----- installer/data/mysql/mandatory/sysprefs.sql | 1 - .../prog/en/includes/html-customization-help.inc | 4 ++++ .../prog/en/modules/admin/preferences/opac.pref | 5 +---- .../prog/en/modules/tools/additional-contents.tt | 2 +- .../bootstrap/en/modules/opac-blocked.tt | 15 +++++++-------- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_27734.perl b/installer/data/mysql/atomicupdate/bug_27734.perl index 990b4b6672..9c65a21bda 100644 --- a/installer/data/mysql/atomicupdate/bug_27734.perl +++ b/installer/data/mysql/atomicupdate/bug_27734.perl @@ -4,9 +4,6 @@ if( CheckVersion( $DBversion ) ) { INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo') }); - $dbh->do(q{ - INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES - ('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea') - }); - NewVersion( $DBversion, 27734, "Add OpacHiddenRecordRedirect and OpacHiddenRecordMessage preferences"); + + NewVersion( $DBversion, 27734, "Add OpacHiddenRecordRedirect preference"); } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 6bb58248f1..4278dcdbbf 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -492,7 +492,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'), ('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'), ('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo'), -('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea'), ('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'), ('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'), ('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc index d33c36cc8d..fc9963e05c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc @@ -38,6 +38,10 @@ Include this content in the header of all pages in the OPAC. +
+ Display the following message on the redirect page for hidden bibliographic records. Depends on the system preferences OpacHiddenItems and OpacHiddenRecordRedirect. +
+
Include this content on the library information page in the OPAC.
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index cf2168d493..9fb54538d1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -646,10 +646,7 @@ OPAC: choices: 1: "an explanatory page ('This record is blocked')." 0: "the 404 error page ('Not found')." - - "
Display the following message on the redirect page for suppressed bibliographic records:" - - pref: OpacHiddenRecordMessage - type: textarea - class: code + - "
Display a message on the redirect page for suppressed bibliographic records with HTML customization OpacHiddenRecordMessage." - - pref: OpacAllowPublicListCreation default: 1 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index cae16e2d56..a101f03f24 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -527,7 +527,7 @@ [% END %] [% END %] [% ELSE %] - [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions', 'ILLModuleCopyrightClearance' ] %] + [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacHiddenRecordMessage', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions', 'ILLModuleCopyrightClearance' ] %] [% FOREACH l IN opac_available_options.sort %] [% IF l == location %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt index 1c7fbafba3..406298c92f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt @@ -1,9 +1,9 @@ [% USE raw %] [% USE AdditionalContents %] [% SET OpacSuppressionMessage = AdditionalContents.get( location => "OpacSuppressionMessage", lang => lang, library => branchcode || default_branch ) %] +[% SET OpacHiddenRecordMessage = AdditionalContents.get( location => "OpacHiddenRecordMessage", lang => lang, library => branchcode || default_branch ) %] [% PROCESS 'i18n.inc' %] [% PROCESS 'html_helpers.inc' %] -[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% t("Record blocked") | html %] › @@ -27,14 +27,13 @@ <div id="opac-blocked-message" class="maincontent"> <h1>Record blocked</h1> <p>You are not authorized to view this record.</p> - [% IF hidden %] - [% SET OpacBlockedMessage = Koha.Preference("OpacHiddenRecordMessage") %] - [% ELSE %] - [% SET OpacBlockedMessage = Koha.Preference("OpacSuppressionMessage") %] - [% END %] - [% IF ( OpacBlockedMessage ) %] + [% IF ( OpacSuppressionMessage ) || ( hidden ) %] <div id="opacsuppressionmessage"> - [% PROCESS koha_news_block news => OpacSuppressionMessage %] + [% IF hidden %] + [% PROCESS koha_news_block news => OpacHiddenRecordMessage %] + [% ELSE %] + [% PROCESS koha_news_block news => OpacSuppressionMessage %] + [% END %] </div> [% END %] </div> -- 2.34.1