Bug 12071

Summary: javascript broken for a search with double quotes
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: Staff interfaceAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: gmcharlt, nengard, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 12071 - javascript broken for a search with double quotes
Patch fixes encoding problem as well (e.g. äöü)
[SIGNED-OFF] Bug 12071 - javascript broken for a search with double quotes
[PASSED QA] Bug 12071 - Javascript broken for a search with double quotes

Description Fridolin Somers 2014-04-11 08:54:38 UTC
In staff interface, when performing a simple search with a double quote (ie "histoire algerie"), the javascript is broken in results page because of :

function GetZ3950Terms(){
  var strQuery="&frameworkcode=";
  strQuery += "&" + "title" + "=" + ""histoire%20algerie"";

Double quotes are not URI-escaped.
Comment 1 Fridolin Somers 2014-04-11 09:04:31 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2014-04-11 15:20:42 UTC
I can't reproduce this bug in master.
Comment 3 Fridolin Somers 2014-04-14 13:00:11 UTC
(In reply to Owen Leonard from comment #2)
> I can't reproduce this bug in master.
I found it occurs on a server with Debian Squeeze and not on my laptop with Ubuntu 13.10, maybe a difference in library URI::Escape.
Still it must be corrected because most of libraries servers run Debian Squeeze.
Also, escaping URL characters into TT is a better code, regarding to MVC layers.
Comment 4 Marc Véron 2014-04-15 08:31:08 UTC
Created attachment 27116 [details]
Patch fixes encoding problem as well (e.g. äöü)

I tryed to reproduce the problem and found an other one: If you do a search for someting like äöü and then hit Z39.50 button, the encoding in the Z39.50 search form is broken. With patch, the encoding is correct.
Comment 5 Marc Véron 2014-04-15 08:35:50 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2014-04-17 19:02:18 UTC
Created attachment 27272 [details] [review]
[PASSED QA] Bug 12071 - Javascript broken for a search with double quotes

In staff interface, when performing a simple search with
a double quote (ie "histoire algerie"), the javascript
is broken in results page because of :

function GetZ3950Terms(){
  var strQuery="&frameworkcode=";
  strQuery += "&" + "title" + "=" + ""histoire%20algerie"";

This patch moves URI escaping from perl to template with uri TT filter.

Test plan :
- In staff interface, perform a search with double quotes
  that will return no result, ie "aaa xxx"
=> Without patch, javascript is broken
=> With patch, javascript is not broken
- Click on Z3950 button on results page
=> Without patch, the Title input is empty
=> With patch, the Title input contains the search terms

Additional test:
Do a search with something like äöü and then click Z3950
button on results page.
Without patch, encoding is broken in Z3950 form
With patch, encoding is correct.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed a few tabs. Passes tests and QA script.
I can't reproduce the Javascript problem, but I can reproduce
the Z39.50 encoding problem and can detect no regression.
Comment 7 Galen Charlton 2014-04-18 15:51:57 UTC
Pushed to master, thanks Fridolin!
Comment 8 Fridolin Somers 2014-08-01 13:23:24 UTC
Pushed to 3.14.x, will be in 3.14.10
Comment 9 Nicole C. Engard 2014-10-08 12:44:45 UTC
*** Bug 13038 has been marked as a duplicate of this bug. ***