[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. 915a3746879b472649c553717eb579de3bfab0af

Evergreen Git git at git.evergreen-ils.org
Fri Sep 21 10:29:20 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_0 has been updated
       via  915a3746879b472649c553717eb579de3bfab0af (commit)
       via  d363b8eefae87fb90b803d1b42eb9d061557cf2f (commit)
      from  fc105fc32494a73c872c0b2e8a9362e2fc2d9f33 (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 915a3746879b472649c553717eb579de3bfab0af
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 9daaea8..db55f10 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/;
 
@@ -3240,9 +3241,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) {
@@ -3260,16 +3261,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 d363b8eefae87fb90b803d1b42eb9d061557cf2f
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 c8c3ea7..9daaea8 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
@@ -446,7 +446,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).
@@ -3052,7 +3054,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) {
@@ -3222,7 +3225,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