-my @select_branches;
-my %select_branches;
-push @select_branches,"";
-$select_branches{""}="";
-my ($count, @branches) = branches();
-#branches is IndependantBranches aware
-foreach my $branch (@branches){
- push @select_branches, $branch->{branchcode};
- $select_branches{$branch->{branchcode}}=$branch->{branchname};
+my $branches = getbranches;
+my @branchloop;
+foreach my $thisbranch (sort keys %$branches) {
+ my %row =(value => $thisbranch,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;