Search for asset stat cat entries by owner in Evergreen driver _init.
authorJason Stephenson <jason@sigio.com>
Tue, 15 Jul 2014 21:06:50 +0000 (17:06 -0400)
committerJason Stephenson <jason@sigio.com>
Mon, 21 Jul 2014 00:07:37 +0000 (20:07 -0400)
Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/ILS/Evergreen.pm

index 41ac7fc..952b2bf 100644 (file)
@@ -310,13 +310,14 @@ sub _init {
             my $asce = $e->retrieve_asset_stat_cat_entry($_->{id});
             push(@{$self->{asces}}, $asce) if ($asce);
         } elsif ($_->{asc} && $_->{name}) {
-            # We may actually want to retrieve the ancestor tree
-            # beginning with $self->{config}->{work_ou} and limit the
-            # next search where the owner is one of those org units.
+            # We want to limit the search to the work org and its
+            # ancestors.
+            my $ancestors = $U->get_org_ancestors($self->{config}->{work_ou});
             my $result = $e->search_asset_stat_cat_entry(
                 {
                     stat_cat => $_->{asc},
-                    value => $_->{name}
+                    value => $_->{name},
+                    owner => $ancestors
                 }
             );
             if ($result && @$result) {