From 3b5c9e953c6cc3444d6ab94ba837bd5030be47b4 Mon Sep 17 00:00:00 2001
From: joshferraro <joshferraro>
Date: Wed, 6 Jul 2005 21:32:02 +0000
Subject: [PATCH] synching with rel_2_2

---
 opac/opac-reserve.pl | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index ef2b49aabd..154b8f66e9 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -57,6 +57,10 @@ my $branch = $query->param('branch');
 $template->param(branch => $branch);
 
 my $branches = getbranches();
+# make sure it's a real branch
+if (!$branches->{$branch}) {
+$branch='';
+}
 $template->param(branchname => $branches->{$branch}->{'branchname'});
 
 # make branch selection options...
@@ -65,18 +69,20 @@ my @branches;
 my @select_branch;
 my %select_branches;
 
+my @CGIbranchlooparray;
+
 foreach my $branch (keys %$branches) {
 	if ($branch) {
-		push @select_branch, $branch;
-		$select_branches{$branch} = $branches->{$branch}->{'branchname'};
+		my %line;
+                $line{branch} = $branches->{$branch}->{'branchname'};
+                $line{value} = $branch;
+                push @CGIbranchlooparray, \%line;
 	}
 }
-my $CGIbranch=CGI::scrolling_list( -name     => 'branch',
-			-values   => \@select_branch,
-			-labels   => \%select_branches,
-			-size     => 1,
-			-multiple => 0 );
-$template->param( CGIbranch => $CGIbranch);
+@CGIbranchlooparray = sort {$a->{branch} cmp $b->{branch}} @CGIbranchlooparray;
+my $CGIbranchloop = \@CGIbranchlooparray;
+$template->param( CGIbranch => $CGIbranchloop);
+
 
 #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED UP!
 # get the itemtype data....