View | Details | Raw Unified | Return to bug 31385
Collapse All | Expand All

(-)a/opac/opac-page.pl (-3 / +1 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use C4::Auth qw( get_template_and_user );
21
use C4::Auth qw( get_template_and_user );
22
use C4::Languages qw(getlanguage);
23
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
24
use Koha::AdditionalContents;
23
use Koha::AdditionalContents;
25
24
Lines 46-52 if (C4::Context->userenv) { Link Here
46
if( $page_id ) {
45
if( $page_id ) {
47
    $page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'], branchcode => [ $homebranch, undef ] });
46
    $page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'], branchcode => [ $homebranch, undef ] });
48
} elsif( $code ) {
47
} elsif( $code ) {
49
    my $lang = $query->param('lang') || C4::Languages::getlanguage($query); # URL param overrides getlanguage
48
    my $lang = $query->param('language') || $query->cookie('KohaOpacLanguage');
50
    # In the next query we make sure that the 'default' records come after the regular languages
49
    # In the next query we make sure that the 'default' records come after the regular languages
51
    $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' ]}} );
50
    $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' ]}} );
52
}
51
}
53
- 

Return to bug 31385