Bugzilla – Attachment 52628 Details for
Bug 16776
If language is set by external link language switcher does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16776 - If language is set by external link language switcher does not work
Bug-16776---If-language-is-set-by-external-link-la.patch (text/plain), 2.23 KB, created by
Marc Véron
on 2016-06-20 20:56:47 UTC
(
hide
)
Description:
Bug 16776 - If language is set by external link language switcher does not work
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-06-20 20:56:47 UTC
Size:
2.23 KB
patch
obsolete
>From 18e412c6958709f4918a2f9eb714538485660903 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 20 Jun 2016 21:25:32 +0200 >Subject: [PATCH] Bug 16776 - If language is set by external link language > switcher does not work > >To reproduce: > >- Have a multilingual koha installation, let's say en, de-CH, fr-FR and it-IT >- Create external links e.g. from your multilingual library website to each language variant of OPAC: > >...cgi-bin/koha/opac-main.pl?language=en >...cgi-bin/koha/opac-main.pl?language=de-CH >...cgi-bin/koha/opac-main.pl?language=fr-FR >...cgi-bin/koha/opac-main.pl?language=it-IT > >Each link opens fine displaying the language as appropriate. > >Now try to switch language on the page you just opened via the external link. > >It won't work, it will always stay on the language defined by the external link. > >To test: >- Apply patch >- Repeat steps above >- Verify that the language switcher works >- Verify in browser address field that after switching language, the param 'language= 'has vanished from url string >- Try links with multiple params and with params containing 'language', e.g. > ...cgi-bin/koha/opac-search.pl?language=fr-FR&q=language&mylanguage=test >- Verify that only the parameter 'language=' vanishes >--- > opac/opac-changelanguage.pl | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > >diff --git a/opac/opac-changelanguage.pl b/opac/opac-changelanguage.pl >index 2773704..db85380 100755 >--- a/opac/opac-changelanguage.pl >+++ b/opac/opac-changelanguage.pl >@@ -25,4 +25,22 @@ my $language = $query->param('language'); > my $url = $query->referer() || '/'; > > # warn "Language : $query // $language // $url"; >+ >+# If language was set by an external URL the parameter >+# 'language=' should be removed from url string, otherwise >+# the language picker will not work - Bug 16776 >+ >+my @urlarr = split(/\?/,$url); >+if (scalar @urlarr > 1) { >+ my @paramarr = split(/&/,$urlarr[1]); >+ for my $index ( reverse 0..$#paramarr ) { >+ if ( $paramarr[$index] =~ /^language=/) { >+ splice(@paramarr, $index, 1, ()); >+ } >+ } >+ if ( scalar @paramarr > 0) { >+ $url = $urlarr[0].'?'.join('&', @paramarr); >+ } >+} >+ > C4::Templates::setlanguagecookie( $query, $language, $url ); >-- >1.7.10.4
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 16776
:
52628
|
53331
|
53473
|
53693
|
53704
|
54117