@@ -, +, @@ --- C4/Search.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/C4/Search.pm +++ a/C4/Search.pm @@ -1235,10 +1235,18 @@ sub buildQuery { $q =~ s| and \( \(allrecords,AlwaysMatches=''\) and \(not-onloan-count,st-numeric >= 1\) and \(lost,st-numeric=0\) \)||; $original_q = $q; } + unless ( grep { $_ eq 'withoutitems' } @limits ) { + $q =~ s| and \( allrecords,AlwaysMatches='' not\(homebranch,AlwaysMatches=''\) \)||; + $original_q = $q; + } if ( @limits ) { if ( grep { $_ eq 'available' } @limits ) { $q .= q| and ( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) )|; - @limits = grep {!/^available$/} @limits; + @limits = grep { $_ ne 'available' } @limits; + } + if ( grep { $_ eq 'withoutitems' } @limits ) { + $q .= q| and ( allrecords,AlwaysMatches='' not(homebranch,AlwaysMatches='') )|; + @limits = grep { $_ ne 'withoutitems' } @limits; } $q .= ' and '.join(' and ', @limits) if @limits; } --