[Koha-patches] [PATCH] Bug 3711 removes leading/trailing spaces from search term

Chris Cormack chris at bigballofwax.co.nz
Tue May 11 09:57:10 CEST 2010


From: Jane Wagner <jwagner at ptfs.com>

Sending a search with a leading space triggers a jquery error; this
strips out leading (and trailing, just in case) spaces.

Updated to apply on master - chris at bigballofwax.co.nz
---
 opac/opac-search.pl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index e1d61fa..62727f5 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -358,6 +358,8 @@ my @results;
 ## I. BUILD THE QUERY
 my $lang = C4::Output::getlanguagecookie($cgi);
 ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang);
+$query_desc =~ s/^\s+//;        # removes leading space
+$query_desc =~ s/\s+$//;        # removes trailing space
 
 sub _input_cgi_parse ($) { 
     my @elements;
-- 
1.6.3.3




More information about the Koha-patches mailing list