LP#1745233: Don't test for LURIs during copy location searches
authorMike Rylander <mrylander@gmail.com>
Mon, 16 Apr 2018 14:29:05 +0000 (10:29 -0400)
committerKathy Lussier <klussier@masslnc.org>
Mon, 23 Apr 2018 17:09:28 +0000 (13:09 -0400)
When a user is searching with a copy location or location group filter,
Located URIs should not be used to include records in the result set because
they are not "within" a copy location.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index b3e64eb..981bff9 100644 (file)
@@ -1455,13 +1455,15 @@ sub flatten {
     push @{$vis_filter{'c_attr'}},
         "search.calculate_visibility_attribute_test('circ_lib','{".join(',', @$dorgs)."}',$negate)";
 
-    my $lorgs = [@$aorgs];
-    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));
+    if (!$self->find_filter('locations') && !$self->find_filter('location_groups')) {
+        my $lorgs = [@$aorgs];
+        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));
 
-    $uses_bre = 1;
-    push @{$vis_filter{'b_attr'}},
-        "search.calculate_visibility_attribute_test('luri_org','{".join(',', @$lorgs)."}',$negate)";
+        $uses_bre = 1;
+        push @{$vis_filter{'b_attr'}},
+            "search.calculate_visibility_attribute_test('luri_org','{".join(',', @$lorgs)."}',$negate)";
+    }
 
     my @dlist = ();
     my $common = 0;