Libraries (branches) should be sorted by branchname.
authorJoe Atzberger <joe.atzberger@liblime.com>
Tue, 30 Dec 2008 19:50:15 +0000 (13:50 -0600)
committerGalen Charlton <galen.charlton@liblime.com>
Fri, 6 Mar 2009 19:04:36 +0000 (13:04 -0600)
The display sorted by code, resulting in nonsensical order
for the users, who don't know or see the codes.  Note,
this data should come from GetBranchesLoop, when that
function is availabled (from a separate patch).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
opac/opac-search.pl

index c973bc0..f9d51f9 100755 (executable)
@@ -116,11 +116,12 @@ if (C4::Context->preference('TagsEnabled')) {
 
 # load the branches
 my $branches = GetBranches();
-my @branch_loop;
-
-for my $branch_hash (sort keys %$branches) {
-    push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, };
-}
+# FIXME: next line duplicates GetBranchesLoop(0,0);
+my @branch_loop = map {
+                    {value => $_, branchname => $branches->{$_}->{branchname}}
+                } sort {
+                    $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
+                } keys %$branches;
 
 my $categories = GetBranchCategories(undef,'searchdomain');