Bugzilla – Attachment 26997 Details for
Bug 12071
javascript broken for a search with double quotes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12071 - javascript broken for a search with double quotes
Bug-12071---javascript-broken-for-a-search-with-do.patch (text/plain), 4.89 KB, created by
Fridolin Somers
on 2014-04-11 09:04:31 UTC
(
hide
)
Description:
Bug 12071 - javascript broken for a search with double quotes
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2014-04-11 09:04:31 UTC
Size:
4.89 KB
patch
obsolete
>From 2b6d41dc03c94921a78b96594aa272abd1077ed1 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 11 Apr 2014 10:54:57 +0200 >Subject: [PATCH] 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 >--- > C4/Search.pm | 8 ++++---- > koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt | 2 +- > 4 files changed, 7 insertions(+), 7 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 09c1951..34d0fd7 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -2251,7 +2251,7 @@ $arrayref = z3950_search_args($matchpoints) > > This function returns an array reference that contains the search parameters to be > passed to the Z39.50 search script (z3950_search.pl). The array elements >-are hash refs whose keys are name, value and encvalue, and whose values are the >+are hash refs whose keys are name and value, and whose values are the > name of a search parameter, the value of that search parameter and the URL encoded > value of that parameter. > >@@ -2262,7 +2262,7 @@ data is in a hash reference in $matchpoints, as returned by Biblio::GetBiblioDat > > If $matchpoints is a scalar, it is assumed to be an unnamed query descriptor, e.g. > a general purpose search argument. In this case, the returned array contains only >-entry: the key is 'title' and the value and encvalue are derived from $matchpoints. >+entry: the key is 'title' and the value is derived from $matchpoints. > > If a search parameter value is undefined or empty, it is not included in the returned > array. >@@ -2309,8 +2309,8 @@ sub z3950_search_args { > my $array = []; > for my $field (qw/ lccn isbn issn title author dewey subject /) > { >- my $encvalue = URI::Escape::uri_escape_utf8($bibrec->{$field}); >- push @$array, { name=>$field, value=>$bibrec->{$field}, encvalue=>$encvalue } if defined $bibrec->{$field}; >+ push @$array, { name => $field, value => $bibrec->{$field} } >+ if defined $bibrec->{$field}; > } > return $array; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index ff5d4bb..8cf5096 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -18,7 +18,7 @@ > function GetZ3950Terms(){ > var strQuery="&frameworkcode="; > [% FOREACH z3950_search_param IN z3950_search_params %] >- strQuery += "&" + "[% z3950_search_param.name |html %]" + "=" + "[% z3950_search_param.encvalue |html %]"; >+ strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]"; > [% END %] > return strQuery; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 7bb75f8..227d298 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -232,7 +232,7 @@ function PopupZ3950() { > function GetZ3950Terms(){ > var strQuery="&frameworkcode="; > [% FOREACH z3950_search_param IN z3950_search_params %] >- strQuery += "&" + "[% z3950_search_param.name %]" + "=" + "[% z3950_search_param.encvalue %]"; >+ strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]"; > [% END %] > return strQuery; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >index d2ab6a8..4f73372 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >@@ -28,7 +28,7 @@ > function GetZ3950Terms(fw){ > var strQuery="&frameworkcode=" + fw; > [% FOREACH z3950_search_param IN z3950_search_params %] >- strQuery += "&" + "[% z3950_search_param.name %]" + "=" + "[% z3950_search_param.encvalue %]"; >+ strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.encvalue |uri %]"; > [% END %] > return strQuery; > } >-- >1.8.3.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 12071
:
26997
|
27116
|
27117
|
27272