QueryParser: Check for URIs in staff visibility
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 19 Feb 2013 16:42:08 +0000 (11:42 -0500)
committerBen Shum <bshum@biblio.org>
Mon, 25 Feb 2013 16:40:21 +0000 (11:40 -0500)
Specifically, don't show staff records with no copies but with URIs unless the
URIs are "in scope".

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index ff33c23..e11aa0d 100644 (file)
@@ -903,6 +903,16 @@ sub toSQL {
                         AND pr.peer_record = m.source
                     LIMIT 1
                 )
+                AND
+                NOT EXISTS(
+                    SELECT 1 FROM asset.call_number acn
+                        JOIN asset.uri_call_number_map aucnm ON acn.id = aucnm.call_number
+                        JOIN asset.uri uri ON aucnm.uri = uri.id
+                    WHERE NOT acn.deleted
+                        AND uri.active
+                        AND acn.record = m.source
+                    LIMIT 1
+                )
             )
         SQL
     } else {