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.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Lucas Gass 2022-01-14 00:59:46 +00:00 committed by Fridolin Somers
parent 87f3be7a57
commit 2544210395
5 changed files with 26 additions and 8 deletions

View File

@ -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";
}
}
}

View File

@ -438,7 +438,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'),

View File

@ -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):'
- '<br />Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.'

View File

@ -424,7 +424,7 @@
<option value="slip">Slip</option>
[% 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 %]
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
[% ELSE %]

View File

@ -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 ) %]
<button id="scrolltocontent">Skip to main content</button>
<div id="wrapper">
@ -352,7 +353,7 @@
[% END %]
</a>
</li>
[% Koha.Preference('OpacMoreSearches') | $raw %]
[% PROCESS koha_news_block news => OpacMoreSearches %]
</ul> <!-- /.nav#moresearches -->
</div> <!-- /.row -->
</div> <!-- /.container-fluid -->