From bc135ba1e11341875610e24bd9e6e2fe23b3b328 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 1 Mar 2022 17:32:13 +0000 Subject: [PATCH] Bug 24221: Move OPACMySummaryNote to HTML customizations in additional-contents To test: 1- Before applying the patch add some content to the system preference OPACMySummaryNote 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 OpacMySummaryNote in HTML customizations 6. Try searching for the system preference, OPACMySummaryNote. It has been removed and you should not be able to find it. 7. Try changing/removing/adding content from OpacMySummaryNote in HTML customizations 8. Make sure your edits are reflected when you look at the user summary page Note: The system preference was named OPACMySummaryNote but in to be more consitent with how we have named other additional_contents I have renamed this OpacMySummaryNote. Signed-off-by: shiyao Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers --- ...opacmysummarynote-to-addtional-contents.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/modules/opac-user.tt | 6 ++--- 5 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24221_move-opacmysummarynote-to-addtional-contents.pl diff --git a/installer/data/mysql/atomicupdate/bug_24221_move-opacmysummarynote-to-addtional-contents.pl b/installer/data/mysql/atomicupdate/bug_24221_move-opacmysummarynote-to-addtional-contents.pl new file mode 100644 index 0000000000..61ca95d94e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24221_move-opacmysummarynote-to-addtional-contents.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "24221", + description => "Move OpacMySummaryNote to additional contents", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Get any existing value from the OpacMySummaryNote system preference + my ( $opacmysummarynote ) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OPACMySummaryNote'; + |); + if( $opacmysummarynote ){ + # 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', 'OpacMySummaryNote', 'OpacMySummaryNote', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacMySummaryNote $lang", $opacmysummarynote, $lang ); + } + # Remove old system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACMySummaryNote'"); + say $out "Bug 24221 update done"; + } + } +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index deaf6b6fc2..94e2463434 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -439,7 +439,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), ('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'), ('OpacNoItemTypeImages','0',NULL,'If ON, disables itemtype images in the OPAC','YesNo'), ('OPACNoResultsFound','','70|10','Display this HTML when no results are found for a search in the OPAC','Textarea'), 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 a214dae954..82ad87630f 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 @@ -239,11 +239,6 @@ OPAC: type: textarea syntax: text/html class: code - - - - "Note to display on the patron summary page. This note only appears if the patron is logged in:" - - pref: OPACMySummaryNote - type: textarea - syntax: text/html - - "Include the following HTML under the facets in OPAC search results:" - pref: OPACResultsSidebar 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 92fcf23cc9..b611e4df73 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 @@ -429,7 +429,7 @@ [% END %] [% ELSE %] - [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches' ] %] + [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote' ] %] [% IF l == location %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 481fecc1a1..c9156c45f9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -9,6 +9,7 @@ [% USE AdditionalContents %] [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] +[% SET OpacMySummaryNote = AdditionalContents.get( location => "OpacMySummaryNote", lang => lang, library => branchcode ) %] [% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %] [% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] @@ -162,9 +163,8 @@ [% END # / IF patron_flagged %] - - [% IF Koha.Preference('OPACMySummaryNote') %] -
[% Koha.Preference('OPACMySummaryNote') | $raw %]
+ [% IF ( OpacMySummaryNote ) %] +
[% PROCESS koha_news_block news => OpacMySummaryNote %]
[% END %] [% IF Koha.Preference('AllowPatronToControlAutorenewal') %] -- 2.39.5