[Koha-patches] [PATCH] Bug 10578 - Escaping CGI breaks results sort feature (librarian's interface)

Janusz Kaczmarek januszop at gmail.com
Thu Jul 11 19:24:31 CEST 2013


To test  (in librarian's interface):

1. Have some biblio records to get a list when searching.
2. Make an advanced search with 'as phrase' modifier (title -- ti,phr:
or author -- au,phr: , etc.)
3. Having the result list try to change the sort order.
4. You should get no results with a message like: "No results match your
search for 'au%2Cphr: " etc.
5. Apply the patch
6. Repeat steps 2. & 3.
7. You should get the list sorted according to your choice.
---
 catalogue/search.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/catalogue/search.pl b/catalogue/search.pl
index d4e98b1..768a801 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -148,6 +148,7 @@ use C4::Languages qw(getAllLanguages);
 use C4::Koha;
 use C4::Members qw(GetMember);
 use C4::VirtualShelves;
+use URI::Escape;
 use POSIX qw(ceil floor);
 use C4::Branch; # GetBranches
 
@@ -392,10 +393,12 @@ unless (@servers) {
 # operators include boolean and proximity operators and are used
 # to evaluate multiple operands
 my @operators = $cgi->param('op');
+ at operators = map { uri_unescape($_) } @operators;
 
 # indexes are query qualifiers, like 'title', 'author', etc. They
 # can be single or multiple parameters separated by comma: kw,right-Truncation 
 my @indexes = $cgi->param('idx');
+ at indexes = map { uri_unescape($_) } @indexes;
 
 # if a simple index (only one)  display the index used in the top search box
 if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
@@ -407,9 +410,11 @@ if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
 
 # an operand can be a single term, a phrase, or a complete ccl query
 my @operands = $cgi->param('q');
+ at operands = map { uri_unescape($_) } @operands;
 
 # limits are use to limit to results to a pre-defined category such as branch or language
 my @limits = $cgi->param('limit');
+ at limits = map { uri_unescape($_) } @limits;
 
 if($params->{'multibranchlimit'}) {
     my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
-- 
1.7.2.5



More information about the Koha-patches mailing list