From: erickson Date: Tue, 5 Feb 2008 15:52:44 +0000 (+0000) Subject: repaired descendant logic for initial high perm org X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=306ef134af2540d9a9cfb5fc2b33a70d3ce25746;p=Evergreen.git repaired descendant logic for initial high perm org git-svn-id: svn://svn.open-ils.org/ILS/trunk@8636 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index be346a769b..b7aacf7c8a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -1304,16 +1304,18 @@ sub find_highest_work_orgs { return [] if $high_org_id == -1; # not allowed anywhere - push(@allowed_orgs, $high_org_id); - my $high_org = $self->find_org($org_tree, $high_org_id); + my $high_org = $self->find_org($org_tree, $high_org_id); my ($high_org_type) = grep { $_->id == $high_org->ou_type } @$org_types; - return [$high_org_id] if $high_org_type->depth == 0; + my $org_depth = $high_org_type->depth; + + if($$options{descendants}) { + push(@allowed_orgs, @{$self->get_org_descendants($high_org_id, $org_depth)}); + } else { + push(@allowed_orgs, $high_org_id); + } - # now that we have the highest depth, find the org in the tree relative to - # each work org at that depth. - my ($org_type) = grep { $_->id == $high_org->ou_type } @$org_types; - my $org_depth = $org_type->depth; + return \@allowed_orgs if $org_depth == 0; for my $org (@$work_orgs) {