diff --git a/C4/Auth.pm b/C4/Auth.pm index 8606e64bb8..7d91b8fff2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -590,7 +590,6 @@ sub get_template_and_user { OpacBrowser => C4::Context->preference("OpacBrowser"), OpacCloud => C4::Context->preference("OpacCloud"), OpacKohaUrl => C4::Context->preference("OpacKohaUrl"), - OpacNav => "" . C4::Context->preference("OpacNav"), OpacNavBottom => "" . C4::Context->preference("OpacNavBottom"), OpacPasswordChange => C4::Context->preference("OpacPasswordChange"), OPACPatronDetails => C4::Context->preference("OPACPatronDetails"), @@ -1293,7 +1292,6 @@ sub checkauth { LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, opacuserlogin => C4::Context->preference("opacuserlogin"), - OpacNav => C4::Context->preference("OpacNav"), OpacNavBottom => C4::Context->preference("OpacNavBottom"), OpacFavicon => C4::Context->preference("OpacFavicon"), opacreadinghistory => C4::Context->preference("opacreadinghistory"), diff --git a/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl b/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl new file mode 100755 index 0000000000..edbc55d8a5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl @@ -0,0 +1,49 @@ +use Modern::Perl; + +return { + bug_number => "24223", + description => "Move contents of OpacNav system preference into additional contents", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + # get list of installed translations + require C4::Languages; + my @langs; + my $tlangs = C4::Languages::getTranslatedLanguages(); + + foreach my $language ( @$tlangs ) { + foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { + push @langs, $sublanguage->{'rfc4646_subtag'}; + } + } + + # There must be a "default" entry in addition to language-specific ones + push @langs, "default"; + + # Get any existing value from the OpacNav system preference + my ($opacnav) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OpacNav'; + |); + if( $opacnav ){ + # If there is a value in the OpacNav preference, insert it into additional_contents + my $code = ''; + foreach my $lang ( @langs ) { + say $out "Inserting OpacNav contents into $lang news item..."; + $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', '', 'OpacNav', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacNav $lang", $opacnav, $lang ); + my $idnew = $dbh->last_insert_id(undef, undef, 'additional_contents', undef); + if( $code eq '' ){ + $code = "News_$idnew"; + } + $dbh->do(q|UPDATE additional_contents SET code=? WHERE idnew = ?|, undef, $code, $idnew); + } + + # Remove the OpacNav system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacNav'"); + say $out "Bug 24223 update done"; + } else { + say $out "No OpacNav preference found. Update has already been run."; + } + + }, +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 3cfe4dd54a..d8d2f1f11c 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -441,7 +441,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), -('OpacNav','Important links here.','70|10','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','Textarea'), ('OpacNavBottom','Important links here.','70|10','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','Textarea'), ('OpacNewsLibrarySelect','0','','Show selector for branches on OPAC news page','YesNo'), ('OpacNoItemTypeImages','0',NULL,'If ON, disables itemtype images in the OPAC','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 253cec7a06..63be5e5873 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 @@ -226,13 +226,7 @@ OPAC: syntax: css class: code - - - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):" - - pref: OpacNav - type: textarea - syntax: text/html - class: code - - - - 'Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:' + - 'Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:' - pref: OpacNavBottom type: textarea syntax: text/html 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 fecb347618..ae8be5e4a2 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 @@ -436,7 +436,7 @@ [% END %] [% ELSE %] - [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %] + [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %] [% IF l == location %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc index b03cf6c537..98f9681a16 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc @@ -3,7 +3,7 @@ [% USE AdditionalContents %] [% PROCESS 'html_helpers.inc' %] [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] -[% SET OpacHeader = AdditionalContents.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %] +[% SET OpacHeader = AdditionalContents.get( location => "opacheader", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %]