From 35cefe9d5229d3cc5847f6daee7d9e44e5e5afac Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 14 Jan 2022 00:59:46 +0000 Subject: [PATCH] Bug 24220: Move OpacMoreSearches to HTML customizations in additional-contents To test: 1- Before applying the patch add some content to the system preference OpacMoreSearches 2- Apply patch 3- restart_all and updatedatabase 4. Go to additional-content.pl ( HTML customizations ) 5. You should now see your content from the system preference under OpacMoreSearches in HTML customizations 6. Try searching for the system preference, OpacMoreSeaches. It has been removed and you should not be able to find it. 7. Try changing/removing/adding content from OpacMoreSearches in HTML customizations 8. Make sure your edits are reflected when you look at the OpacMoreSearch area in the OPAC. --- ...e-opacmoresearches-to-addtional-content.pl | 23 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 - .../en/modules/admin/preferences/opac.pref | 5 ---- .../en/modules/tools/additional-contents.tt | 2 +- .../bootstrap/en/includes/masthead.inc | 3 ++- 5 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl diff --git a/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl b/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl new file mode 100644 index 0000000000..aec89d9cce --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "24220", + description => "Move OpacMoreSearches to additional contents", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Get any existing value from the OpacMoreSearches system preference + my ( $opacmoresearches ) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OpacMoreSearches'; + |); + if( $opacmoresearches ){ + # Insert any values found from system preference into additional_contents + foreach my $lang ( 'default' ) { + $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacMoreSearches', 'OpacMoreSearches', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacMoreSearches $lang", $opacmoresearches, $lang ); + } + # Remove old system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMoreSearches'"); + say $out "Bug 24220 update done"; + } + } +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 1384649444..4c69c05c13 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -437,7 +437,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'), ('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), ('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea'), -('OpacMoreSearches', '', NULL, 'Add additional elements to the OPAC more searches bar', 'Textarea'), ('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my checkout history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'), ('OPACMySummaryNote','','','Note to display on the patron summary page. This note only appears if the patron is connected.','Free'), ('OpacNewsLibrarySelect','0','','Show selector for branches on OPAC news page','YesNo'), 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 20bdbd959e..bc0f0aeb7f 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 @@ -232,11 +232,6 @@ OPAC: type: textarea syntax: text/html class: code - - - - 'Add additional elements to the "More Searches" bar on the OPAC, with the following HTML (leave blank to disable):' - - pref: OpacMoreSearches - type: textarea - class: code - - 'Include a "Links" column on the "my summary" and "my checkout history" tabs when a patron is logged in to the OPAC, with the following HTML (leave blank to disable):' - '
Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.' 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 1c3ac717cc..0337278569 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 @@ -424,7 +424,7 @@ [% END %] [% ELSE %] - [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %] + [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches' ] %] [% IF l == location %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index c2cf93a090..d4192f834a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -8,6 +8,7 @@ [% SET OpacHeader = AdditionalContents.get( location => "opacheader", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %] [% SET OpacCustomSearch = AdditionalContents.get( location => "OpacCustomSearch", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %] [% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %] +[% SET OpacMoreSearches = AdditionalContents.get( location => "OpacMoreSearches", lang => lang, library => branchcode ) %]
@@ -352,7 +353,7 @@ [% END %] - [% Koha.Preference('OpacMoreSearches') | $raw %] + [% PROCESS koha_news_block news => OpacMoreSearches %]
-- 2.20.1