From 37835b009dd33edb7b39755981c0dc06cb3fd1ab Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 14 Apr 2008 13:30:49 +0000 Subject: [PATCH] augmented the org descendants retrieval method to take an optional list of orgs git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9337 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Actor.pm | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index cf521ef86d..92a7b14bcf 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -1045,11 +1045,26 @@ __PACKAGE__->register_method( # depth is optional. org_unit is the id sub get_org_descendants { my( $self, $client, $org_unit, $depth ) = @_; - my $orglist = $apputils->simple_scalar_request( - "open-ils.storage", - "open-ils.storage.actor.org_unit.descendants.atomic", - $org_unit, $depth ); - return $U->build_org_tree($orglist); + + if(ref $org_unit eq 'ARRAY') { + $depth ||= []; + my @trees; + for my $i (0..scalar(@$org_unit)-1) { + my $list = $U->simple_scalar_request( + "open-ils.storage", + "open-ils.storage.actor.org_unit.descendants.atomic", + $org_unit->[$i], $depth->[$i] ); + push(@trees, $U->build_org_tree($list)); + } + return \@trees; + + } else { + my $orglist = $apputils->simple_scalar_request( + "open-ils.storage", + "open-ils.storage.actor.org_unit.descendants.atomic", + $org_unit, $depth ); + return $U->build_org_tree($orglist); + } } -- 2.11.0