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

Jane Wagner jwagner at ptfs.com
Wed Oct 14 17:44:06 CEST 2009


Sending a search with a leading space triggers a jquery error; this
strips out leading (and trailing, just in case) spaces.
---
 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 a7f7470..4992e2f 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -331,6 +331,8 @@ my @results;
 
 ## I. BUILD THE QUERY
 ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by);
+	$query_desc =~ s/^\s+//;        # removes leading space
+	$query_desc =~ s/\s+$//;        # removes trailing space
 
 sub _input_cgi_parse ($) { 
     my @elements;
-- 
1.5.6.5




More information about the Koha-patches mailing list