From a3c0ab31399404770b465b3acf0b4e863ef103cb Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 17 Aug 2022 15:05:54 +0000 Subject: [PATCH] Bug 31385: (follow-up) Switch to language param As Katrin suggested, we should use the language URL param instead. If you pass code, we use the language cookie as fallback. If that does not work, we look for default. Test plan: Try former test plan but use code=X&language=Y. Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens --- opac/opac-page.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/opac/opac-page.pl b/opac/opac-page.pl index 7fe0d88582..d5e83f7d4d 100755 --- a/opac/opac-page.pl +++ b/opac/opac-page.pl @@ -19,7 +19,6 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); -use C4::Languages qw(getlanguage); use C4::Output qw( output_html_with_http_headers ); use Koha::AdditionalContents; @@ -46,7 +45,7 @@ if (C4::Context->userenv) { if( $page_id ) { $page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'], branchcode => [ $homebranch, undef ] }); } elsif( $code ) { - my $lang = $query->param('lang') || C4::Languages::getlanguage($query); # URL param overrides getlanguage + my $lang = $query->param('language') || $query->cookie('KohaOpacLanguage'); # In the next query we make sure that the 'default' records come after the regular languages $page = Koha::AdditionalContents->search({ code => $code, lang => ['default', $lang], location => ['opac_only', 'staff_and_opac'], branchcode => [ $homebranch, undef ] }, { order_by => { -desc => \[ 'CASE WHEN lang="default" THEN "" ELSE lang END' ]}} ); } -- 2.30.2