[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. 9a1c1efc50d34c0bebcb30ce8cd6d13016f3f0bb

Evergreen Git git at git.evergreen-ils.org
Fri Sep 21 10:29:14 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_1 has been updated
       via  9a1c1efc50d34c0bebcb30ce8cd6d13016f3f0bb (commit)
       via  4a81d4317e1f1b2491c9fbed82fed5cf9d89af46 (commit)
      from  20ec0244040090a8ac915a28fae9b9acabbecd68 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a1c1efc50d34c0bebcb30ce8cd6d13016f3f0bb
Author: Mike Rylander <mrylander at gmail.com>
Date:   Wed Sep 19 10:26:04 2018 -0400

    LP#1781480: Include group owner ancestor badges
    
    This commit lightly refactors the badge org logic and includes the ancestors
    of location group owners in the list of badge orgs, instead of only the direct
    owners.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Jeanette Lundgren <jlundgren at cwmars.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
index 828304f..3ca3751 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
@@ -8,6 +8,7 @@ use OpenSRF::Utils::Logger qw/:level/;
 use OpenILS::Application::AppUtils;
 use OpenSRF::Utils::Cache;
 use OpenSRF::Utils::JSON;
+use List::MoreUtils qw(uniq);
 use Data::Dumper;
 use Digest::MD5 qw/md5_hex/;
 
@@ -3245,9 +3246,9 @@ sub query_parser_fts_wrapper {
                 my $lg_obj = asset::copy_location_group->retrieve($lg);
                 next unless $lg_obj;
     
-                push(@borg_list, ''.$lg_obj->owner);
+                push(@borg_list, @{$U->get_org_ancestors(''.$lg_obj->owner)});
             }
-            $borgs = join(',', @borg_list) if @borg_list;
+            $borgs = join(',', uniq @borg_list) if @borg_list;
         }
     
         if (!$borgs) {
@@ -3265,16 +3266,8 @@ sub query_parser_fts_wrapper {
             }
 
             if ($site) {
-                $borgs = OpenSRF::AppSession->create( 'open-ils.cstore' )->request(
-                    'open-ils.cstore.json_query.atomic',
-                    { from => [ 'actor.org_unit_ancestors', $site->id ] }
-                )->gather(1);
-
-                if (ref $borgs && @$borgs) {
-                    $borgs = join(',', map { $_->{'id'} } @$borgs);
-                } else {
-                    $borgs = undef;
-                }
+                $borgs = $U->get_org_ancestors($site->id);
+                $borgs = @$borgs ?  join(',', @$borgs) : undef;
             }
         }
     }

commit 4a81d4317e1f1b2491c9fbed82fed5cf9d89af46
Author: Mike Rylander <mrylander at gmail.com>
Date:   Mon Sep 17 11:33:29 2018 -0400

    LP#1781480: Closures remeber values in subtle ways...
    
    ... and we must take care to avoid that.  This commit forces a state variable
    to be statically assigned an empty list rather than depending on the idiomatic
    undef to vivicate an empty list.  This is important for all OpenSRF methods,
    and manifests here as a search "remembering" a previously chosen location
    group.  A comment to that point is included for our future selves.
    
    The core probably arises from the fact that, in the end, OpenSRF methods are
    generated closures.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Jeanette Lundgren <jlundgren at cwmars.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
index 506846a..828304f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
@@ -451,7 +451,9 @@ sub biblio_multi_search_full_rec {
     my $cl_table = asset::copy_location->table;
     my $br_table = biblio::record_entry->table;
 
-    my $cj = 'HAVING COUNT(x.record) = ' . scalar(@selects) if ($class_join eq 'AND');
+    my $cj = undef;
+    $cj = 'HAVING COUNT(x.record) = ' . scalar(@selects) if ($class_join eq 'AND');
+
     my $search_table =
         '(SELECT x.record, sum(x.sum) FROM (('.
             join(') UNION ALL (', @selects).
@@ -3057,7 +3059,8 @@ sub query_parser_fts {
 
     # gather location_groups
     if (my ($filter) = $query->parse_tree->find_filter('location_groups')) {
-        my @loc_groups = @{$filter->args} if (@{$filter->args});
+        my @loc_groups = ();
+        @loc_groups = @{$filter->args} if (@{$filter->args});
         
         # collect the mapped locations and add them to the locations() filter
         if (@loc_groups) {
@@ -3227,7 +3230,11 @@ sub query_parser_fts_wrapper {
         # explicitly supplied one
         my $site = undef;
 
-        my @lg_id_list = @{$args{location_groups}} if (ref $args{location_groups});
+        my @lg_id_list = (); # We must define the variable with a static value
+                             # because an idomatic my+set causes the previous
+                             # value is remembered via closure.  
+
+        @lg_id_list = @{$args{location_groups}} if (ref $args{location_groups});
 
         my ($lg_filter) = $base_plan->parse_tree->find_filter('location_groups');
         @lg_id_list = @{$lg_filter->args} if ($lg_filter && @{$lg_filter->args});

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/metabib.pm       |   30 ++++++++++----------
 1 files changed, 15 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list