Bugzilla – Attachment 144405 Details for
Bug 32251
opac-page.pl: Add a fallback for when language cookie was removed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32251: Add a fallback for when language cookie was removed
Bug-32251-Add-a-fallback-for-when-language-cookie-.patch (text/plain), 2.31 KB, created by
PTFS Europe Sandboxes
on 2022-12-02 16:44:20 UTC
(
hide
)
Description:
Bug 32251: Add a fallback for when language cookie was removed
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2022-12-02 16:44:20 UTC
Size:
2.31 KB
patch
obsolete
>From 4e7df0041cc6da0213f8e246f2db528540d4c90e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 18 Nov 2022 07:23:25 +0000 >Subject: [PATCH] Bug 32251: Add a fallback for when language cookie was > removed > >Since we remove cookies after logout now, the language cookie >might not be there yet. It is friendlier to add the template >language fallback here now too before switching to 'default' in >the Additional contents (AC)-context. > >Note: The cookie will not be removed when you added it to the list >in koha-conf.xml. > >Note2: This only pertains to the use of opac-page with code param. > >Test plan: >[1] Create a CMS page with AC. Add two languages (say en, nl-NL). > Add different text to default and both languages. >[2] Remove the KohaOPACLanguage cookie from your browser (via > dev console). >[3] Without this patch, copy the Current language URL from the AC > overview page. (Note that the Default URL always refers you to > 'default'.) >[4] Go to that page with the selected (Current..) URL. Observe that > you still see the 'default' text. >[5] Remove the cookie again if it might be there already. >[6] With this patch, observe that you get the language of the > interface now on the CMS page using the same URL. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Pascal <pascal.uphaus@gwdg.de> >--- > opac/opac-page.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/opac/opac-page.pl b/opac/opac-page.pl >index d5e83f7d4d..cba09dddfd 100755 >--- a/opac/opac-page.pl >+++ b/opac/opac-page.pl >@@ -45,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('language') || $query->cookie('KohaOpacLanguage'); >+ my $lang = $query->param('language') || $query->cookie('KohaOpacLanguage') || $template->lang; > # 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32251
:
144045
|
144405
|
145512