LP#1849497 - Hide specific org units from staff search results. user/stompro/lp1849497_hide_ou_staff_search
authorJosh Stompro <stompro@stompro.org>
Wed, 23 Oct 2019 14:23:37 +0000 (09:23 -0500)
committerJosh Stompro <stompro@stompro.org>
Wed, 23 Oct 2019 14:23:37 +0000 (09:23 -0500)
Hard coded example of removing certain org units.

Signed-off-by: Josh Stompro <stompro@stompro.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 950a081..10fb6ca 100644 (file)
@@ -1469,6 +1469,14 @@ sub flatten {
     }
     unflesh_parents($ot);
 
+    #staff shouldn't see ILL copies unless searching ILL sites
+    if ($self->find_modifier('staff') and ($site_org->id != 138 and $site_org->id != 140)) {
+       $logger->debug('removing ill orgs from search for staff Before: '.Dumper($dorgs));
+       # remove 138 or 140 from dorgs
+       $dorgs = [ map /(138|140)/ ? () : $_, @$dorgs ];
+       $logger->debug('removing ill orgs from search for staff After: '.Dumper($dorgs));
+    }
+
     push @{$vis_filter{'c_attr'}},
         "search.calculate_visibility_attribute_test('circ_lib','{".join(',', @$dorgs)."}',$negate)";