LP#1746800 Exclude empty records on filtered staff searches
authorDan Briem <dbriem@wlsmail.org>
Wed, 16 Mar 2022 20:45:37 +0000 (16:45 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 24 Mar 2022 17:43:00 +0000 (13:43 -0400)
Excludes empty bibs on staff searches when filtering on location
or location group or when using the availability modifier.

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Signed-off-by: Jennifer Weston <jennifer.weston@equinoxoli.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index c4e3455..fe45ac1 100644 (file)
@@ -1057,7 +1057,7 @@ sub toSQL {
         $final_c_attr_test = 'EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = m.source AND vis_attr_vector @@ c_attr.vis_test)';
     }
  
-    if ($self->find_modifier('staff')) { # staff search
+    if ($self->find_modifier('staff') && !$self->find_modifier('available') && !$self->find_filter('locations') && !$self->find_filter('location_groups')) {
         $final_c_attr_test ||= 'FALSE';
         $final_c_attr_test = '(' . $final_c_attr_test . " OR (" .
                 "NOT EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = m.source) " .