build_org_tree now returns the single org if there is only one in the list
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Apr 2007 13:19:16 +0000 (13:19 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Apr 2007 13:19:16 +0000 (13:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@7151 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm

index 4fa55c9..b7d7e46 100644 (file)
@@ -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 ||
index 5ba1902..0ead768 100644 (file)
@@ -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 {