From 01c0debd20c963591791024b9731f88d374dfdff Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 21 May 2013 15:48:46 -0400 Subject: [PATCH] Bug 10304 - Filter notforloan items when searching for only available items It does not make sense for the "available items only" search limit to include results for items that are not for loan. Test Plan: 1) Catalog 3 records with 1 or more items each, make the first two records' items available for loan, and the third record's items not for loan. 2) Do a search limiting only to available items 3) Note all 3 records are in the search results 4) Apply this patch 5) Refresh the search results 6) Note the third record ( with only not for loan items ) is no longer in the search results list. --- C4/Search.pm | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index aec024b..092dae5 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1520,12 +1520,13 @@ sub buildQuery { 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) -## In English: -## all records not indexed in the onloan register (zebra) and all records with a value of lost equal to 0 + + + # 'available' is defined as (items.onloan is NULL) and (items.itemlost = 0) and ( items.notforloan = 0 ) + # In English: + # all records not indexed in the onloan register (zebra) and all records with a value of lost equal to 0, and notforloan equal to 0 $availability_limit .= -"( ( allrecords,AlwaysMatches='' not onloan,AlwaysMatches='') and (lost,st-numeric=0) )"; #or ( allrecords,AlwaysMatches='' not lost,AlwaysMatches='')) )"; + "( ( allrecords,AlwaysMatches='' not onloan,AlwaysMatches='' ) and ( lost,st-numeric = 0 ) and ( notforloan,st-numeric = 0 ) )"; $limit_cgi .= "&limit=available"; $limit_desc .= ""; } -- 1.7.2.5