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>
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 {