From: Josh Stompro Date: Wed, 23 Oct 2019 14:30:02 +0000 (-0500) Subject: LP#1849161 - Add back in pref_lib located uri feature X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fstompro%2Flp1849161_pref_ou_luri_search;p=working%2FEvergreen.git LP#1849161 - Add back in pref_lib located uri feature Originally added in LP#975577 Allow the pref_lib feature to effect located uri visibility Signed-off-by: Josh Stompro --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index 950a081b63..0025faa233 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -1477,6 +1477,18 @@ sub flatten { my $luri_as_copy_gf = $U->get_global_flag('opac.located_uri.act_as_copy'); push @$lorgs, @$dorgs if ($luri_as_copy_gf and $U->is_true($luri_as_copy_gf->enabled)); + #### Pref Lib Logic + #### Add in pref_ou to luri visibility test + if ($self->find_filter('pref_ou')) { + my $pref_ou = $self->find_filter('pref_ou'); + my $pref_org = $U->find_org_by_shortname($ot, $pref_ou->args->[0]); + $logger->debug('pref_ou is set to: '.$pref_org->id); + if ($pref_org->id != $site_org->id){ #if search scope = pref_lib then no need to add in + my $porgs = $U->get_org_ancestors($pref_org->id); + push @$lorgs, @$porgs; + } + } + $uses_bre = 1; push @{$vis_filter{'b_attr'}}, "search.calculate_visibility_attribute_test('luri_org','{".join(',', @$lorgs)."}',$negate)";