From a5848a54aa79724c7d9f1eeeee954708cc1a4281 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Aug 2012 14:12:09 +0200 Subject: [PATCH] Bug 4491: FIX buildQuery if called with an empty limit if @limit=('') buildQuery failed --- C4/Search.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index fd81610..77b36a1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1100,7 +1100,8 @@ sub buildQuery { my $q=$'; # This is needed otherwise ccl= and &limit won't work together, and # this happens when selecting a subject on the opac-detail page - if (@limits) { + @limits = grep {!/^$/} @limits; + if ( @limits ) { $q .= ' and '.join(' and ', @limits); } return ( undef, $q, $q, "q=ccl=$q", $q, '', '', '', '', 'ccl' ); @@ -1317,6 +1318,7 @@ sub buildQuery { my %group_OR_limits; my $availability_limit; foreach my $this_limit (@limits) { + next unless $this_limit; if ( $this_limit =~ /available/ ) { # ## 'available' is defined as (items.onloan is NULL) and (items.itemlost = 0) -- 1.7.10.4