From f3a7dc7918cc6bd82e610dbe339dfbeb12cc36e6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 11 Dec 2019 13:42:09 +0000 Subject: [PATCH] Bug 22880: (follow-up) Use global language variable for news language This patch removes news-specific code for defining the language of news items queried for the OPAC home page. An identical language variable is already defined globally. Previous to this patch an 'opacheader' news item would only appear on the OPAC home page. Now it should appear on all OPAC pages. --- koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- opac/opac-main.pl | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 4add129977c..2b0aa405e54 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -4,7 +4,7 @@ [% USE Categories %] [% USE KohaNews %] [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] -[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => news_lang, library => branchcode, blocktitle => 0 ) %] +[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
[% END %] - [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => news_lang, library => branchcode ) %] + [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %] [% IF ( OpacNav || OpacNavBottom ) && (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %]
[% ELSIF (Koha.Preference( 'opacuserlogin' ) == 1 || OpacNavRight) %] diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 4af6f1a8181..de5ad8e9455 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -48,10 +48,6 @@ $template->param( casAuthentication => $casAuthentication, ); -# display news -# use cookie setting for language, bug default to syspref if it's not set -my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input); - my $homebranch; if (C4::Context->userenv) { $homebranch = C4::Context->userenv->{'branch'}; @@ -74,7 +70,7 @@ if (defined $news_id){ $template->param( single_news_error => 1 ); } } else { - @all_koha_news = &GetNewsToDisplay($news_lang,$homebranch); + @all_koha_news = &GetNewsToDisplay( $template->lang, $homebranch); } my $quote = GetDailyQuote(); # other options are to pass in an exact quote id or select a random quote each pass... see perldoc C4::Koha @@ -104,7 +100,6 @@ if ( $patron ) { $template->param( koha_news => @all_koha_news, - news_lang => $news_lang, branchcode => $homebranch, display_daily_quote => C4::Context->preference('QuoteOfTheDay'), daily_quote => $quote, -- 2.11.0