Bug 18946

Summary: Change language from external web fails
Product: Koha Reporter: Hugo Agud <hagud>
Component: OPACAssignee: Karam Qubsi <karamqubsi>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, karamqubsi, katrin.fischer, kyle, m.de.rooy, mtj
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19799
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug-18946- Change-language-from-external-web-fails
Bug 18946 - Change language from external web fails
Bug 18946 [QA Followup] - code cleanup
Bug 18946 - Change language from external web fails
Bug 18946 [QA Followup] - code cleanup

Description Hugo Agud 2017-07-17 13:30:21 UTC
We have identified that if you add the url to change language from one external web to koha, it doesn't work it just send you again to your current web.

How to reproduce:
1. Get a multilingüal Koha like 
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=en
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=es-ES

2. Copy that urls to any web page and try to link to the spanish or english version,it will keep you in the same position

we suspect is opac-changelanguage.pl becuase it gets the url from the referer and then construct a wrong url becuase of the referer... If 

#my $url      = $query->referer() || '/';
my $url    = 'https://whatever/';

it works.. because we force the referer to the koha host domain
Comment 1 Karam Qubsi 2017-07-18 09:46:09 UTC Comment hidden (obsolete)
Comment 2 Karam Qubsi 2017-07-18 16:17:12 UTC
Created attachment 65089 [details] [review]
Bug-18946- Change-language-from-external-web-fails

How to reproduce:
1. Get a multilingüal Koha like
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=en
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=es-ES

2. Copy that urls to any web page in an other domain -it must be in some
host - and try to link to the spanish or english version,it will keep you in the same position.

3. Apply this patch and try again , everything should work fine .
Comment 3 Hugo Agud 2017-08-23 08:13:11 UTC
Sorry for the delay, the patch it works fine!

thanks!
Comment 4 Kyle M Hall 2017-09-01 12:42:16 UTC
Created attachment 66719 [details] [review]
Bug 18946 - Change language from external web fails

How to reproduce:
1. Get a multilingüal Koha like
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=en
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=es-ES

2. Copy that urls to any web page in an other domain -it must be in some
host - and try to link to the spanish or english version,it will keep you in the same position.

3. Apply this patch and try again , everything should work fine .

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2017-09-01 12:42:22 UTC
Created attachment 66720 [details] [review]
Bug 18946 [QA Followup] - code cleanup

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2017-09-01 13:08:21 UTC
Created attachment 66733 [details] [review]
Bug 18946 - Change language from external web fails

How to reproduce:
1. Get a multilingüal Koha like
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=en
http://demo1.orex.es/cgi-bin/koha/opac-changelanguage.pl?language=es-ES

2. Copy that urls to any web page in an other domain -it must be in some
host - and try to link to the spanish or english version,it will keep you in the same position.

3. Apply this patch and try again , everything should work fine .

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Kyle M Hall 2017-09-01 13:08:54 UTC
Created attachment 66734 [details] [review]
Bug 18946 [QA Followup] - code cleanup

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Jonathan Druart 2017-09-01 16:06:42 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 9 Fridolin Somers 2017-10-03 09:36:48 UTC
Pushed to 17.05.x, will be in 17.05.05.
Comment 10 Katrin Fischer 2017-10-06 06:11:48 UTC
These patches have been pushed to 16.11.x and will be in 16.11.13.
Comment 11 Mason James 2017-11-23 23:09:24 UTC
Pushed to 16.05.x, for 16.05.18 release
Comment 12 Marcel de Rooy 2018-07-30 11:38:17 UTC
This patch causes the bug reported on bug 19799.
Especially if you use https and Plack..