diff --git a/installer/data/mysql/atomicupdate/bug-34894-move-OpacSuppressionMessage-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-34894-move-OpacSuppressionMessage-to-additional-contents.pl new file mode 100755 index 0000000000..55f9dd9453 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-34894-move-OpacSuppressionMessage-to-additional-contents.pl @@ -0,0 +1,38 @@ +use Modern::Perl; + +return { + bug_number => "34894", + description => "Move OpacSuppressionMessage to additional contents", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Get any existing value from the OpacSuppressionMessage system preference + my ($opacsuppressionmessage) = $dbh->selectrow_array( + q| + SELECT value FROM systempreferences WHERE variable='OpacSuppressionMessage'; + | + ); + if ($opacsuppressionmessage) { + + # Insert any values found from system preference into additional_contents + $dbh->do( + "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'OpacSuppressionMessage', 'OpacSuppressionMessage', NULL, CAST(NOW() AS date) )" + ); + + my ($insert_id) = $dbh->selectrow_array( + "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'OpacSuppressionMessage' AND location = 'OpacSuppressionMessage' LIMIT 1", + {} + ); + + $dbh->do( + "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'OpacSuppressionMessage default', ?, 'default' )", + undef, $insert_id, $opacsuppressionmessage + ); + + # Remove old system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacSuppressionMessage'"); + say $out "Bug 34894 update done"; + } + } + } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 3e6715120d..58dee00d65 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -530,7 +530,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACSuggestionUnwantedFields',NULL,'','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'), ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), ('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'), -('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'), ('OpacSuppressionRedirect','1','Redirect the opac detail page for suppressed records to an explanatory page (otherwise redirect to 404 error page)','','YesNo'), ('opacthemes','bootstrap','','Define the current theme for the OPAC interface.','Themes'), ('OpacTopissue','0',NULL,'If ON, enables the \'most popular items\' link on OPAC. Warning, this is an EXPERIMENTAL feature, turning ON may overload your server','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index 814ce6a904..ffd9b7e549 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -282,10 +282,7 @@ Cataloging: 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: OpacSuppressionMessage - type: textarea - class: code + - "
A custom message can be shown on the redirect page for suppressed bibliographic records by creating an HTML customization in the OpacSuppressionMessage region." - - pref: SeparateHoldings choices: 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 57d81b7af0..3f151c18cb 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 @@ -524,7 +524,7 @@ [% END %] [% END %] [% ELSE %] - [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions' ] %] + [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions' ] %] [% 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 b20a8c677e..c942a6f2c4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt @@ -1,4 +1,6 @@ [% USE raw %] +[% USE AdditionalContents %] +[% SET OpacSuppressionMessage = AdditionalContents.get( location => "OpacSuppressionMessage", lang => lang, library => branchcode || default_branch ) %] [% INCLUDE 'doc-head-open.inc' %] Record blocked › @@ -28,7 +30,7 @@ <p>You are not authorized to view this record.</p> [% IF ( OpacSuppressionMessage ) %] <div id="opacsuppressionmessage"> - [% OpacSuppressionMessage | $raw %] + [% PROCESS koha_news_block news => OpacSuppressionMessage %] </div> [% END %] </div>