[open-ils-commits] r10064 - branches/rel_1_2/Open-ILS/src/sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 17 21:50:30 EDT 2008


Author: miker
Date: 2008-07-17 21:50:29 -0400 (Thu, 17 Jul 2008)
New Revision: 10064

Modified:
   branches/rel_1_2/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Log:
add shelving location filter support

Modified: branches/rel_1_2/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
===================================================================
--- branches/rel_1_2/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-07-18 01:13:10 UTC (rev 10063)
+++ branches/rel_1_2/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-07-18 01:50:29 UTC (rev 10064)
@@ -69,6 +69,7 @@
     param_depth     INT,
     param_searches  TEXT, -- JSON hash, to be turned into a resultset via search.parse_search_args
     param_statuses  INT[],
+    param_locations INT[],
     param_audience  TEXT[],
     param_language  TEXT[],
     param_lit_form  TEXT[],
@@ -438,6 +439,26 @@
 
         END IF;
 
+        IF param_locations IS NOT NULL AND array_upper(param_locations, 1) > 0 THEN
+
+            PERFORM 1
+              FROM  asset.call_number cn
+                    JOIN asset.copy cp ON (cp.call_number = cn.id)
+              WHERE NOT cn.deleted
+                    AND NOT cp.deleted
+                    AND cp.location IN ( SELECT * FROM search.explode_array( param_locations ) )
+                    AND cn.record IN ( SELECT * FROM search.explode_array( core_result.records ) )
+                    AND cp.circ_lib IN ( SELECT * FROM search.explode_array( search_org_list ) )
+              LIMIT 1;
+
+            IF NOT FOUND THEN
+                -- RAISE NOTICE ' % were all copy_location-excluded ... ', core_result.records;
+                excluded_count := excluded_count + 1;
+                CONTINUE;
+            END IF;
+
+        END IF;
+
         IF staff IS NULL OR NOT staff THEN
 
             PERFORM 1



More information about the open-ils-commits mailing list