From: erickson Date: Mon, 16 Apr 2007 13:19:16 +0000 (+0000) Subject: build_org_tree now returns the single org if there is only one in the list X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=910519f4fc202752c181bfadcf5a79fb007fa024;p=Evergreen.git build_org_tree now returns the single org if there is only one in the list git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@7151 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 4fa55c9cef..b7d7e46ad4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -1019,8 +1019,8 @@ sub build_org_tree { my( $self, $orglist) = @_; - return $orglist unless ( - ref($orglist) and @$orglist > 1 ); + return $orglist unless ref $orglist; + return $$orglist[0] if @$orglist == 1; my @list = sort { $a->ou_type <=> $b->ou_type || diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index 5ba19024c1..0ead768620 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -246,8 +246,8 @@ sub build_org_tree { my( $self, $orglist, $add_types ) = @_; - return $orglist unless ( - ref($orglist) and @$orglist > 1 ); + return $orglist unless ref $orglist; + return $$orglist[0] if @$orglist == 1; my @list = sort { $a->ou_type <=> $b->ou_type || @@ -270,7 +270,6 @@ sub build_org_tree { } return $list[0]; - } sub fetch_closed_date {