[Koha-patches] [PATCH] Sorting branches by name whereever it is required
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Wed Nov 19 07:24:25 CET 2008
---
C4/Auth.pm | 2 +-
acqui/neworderempty.pl | 2 +-
acqui/orderreceive.pl | 2 +-
admin/aqbookfund.pl | 2 +-
admin/aqbudget.pl | 2 +-
cataloguing/additem.pl | 2 +-
cataloguing/value_builder/unimarc_field_4XX.pl | 2 +-
circ/bookcount.pl | 2 +-
circ/branchtransfers.pl | 2 +-
circ/overdue.pl | 2 +-
circ/transferstoreceive.pl | 2 +-
opac/opac-search.pl | 2 +-
opac/opac-topissues.pl | 2 +-
opac/opac-user.pl | 2 +-
reports/cat_issues_top.pl | 2 +-
reports/catalogue_out.pl | 2 +-
reports/catalogue_stats.pl | 2 +-
reports/issues_avg_stats.pl | 2 +-
reports/issues_stats.pl | 2 +-
reports/itemslost.pl | 2 +-
reports/reservereport.pl | 2 +-
reserve/request.pl | 4 ++--
serials/serials-recieve.pl | 2 +-
tools/inventory.pl | 2 +-
24 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 871929e..01d8b3f 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -779,7 +779,7 @@ sub checkauth {
# get the branchloop, which we need for authentication
my $branches = GetBranches();
my @branch_loop;
- for my $branch_hash (sort keys %$branches) {
+ for my $branch_hash (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
push @branch_loop, {branchcode => "$branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, };
}
diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index 8baa60b..7b3136b 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -157,7 +157,7 @@ my $onlymine=C4::Context->preference('IndependantBranches') &&
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
-foreach my $thisbranch ( sort keys %$branches ) {
+foreach my $thisbranch ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %row = (
value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl
index b83d02c..ad0e502 100755
--- a/acqui/orderreceive.pl
+++ b/acqui/orderreceive.pl
@@ -140,7 +140,7 @@ if ( $count == 1 ) {
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
- foreach my $thisbranch ( sort keys %$branches ) {
+ foreach my $thisbranch ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %row = (
value => $thisbranch,
selected => $thisbranch eq $results[0]->{'branchcode'},
diff --git a/admin/aqbookfund.pl b/admin/aqbookfund.pl
index d5673c8..40d717d 100755
--- a/admin/aqbookfund.pl
+++ b/admin/aqbookfund.pl
@@ -125,7 +125,7 @@ if ($op eq 'add_form') {
$template->param(bookfundname =>$dataaqbookfund->{'bookfundname'});
my @branchloop;
- foreach my $branchcode (sort keys %{$branches}) {
+ foreach my $branchcode (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %{$branches}) {
my $row = {
branchcode => $branchcode,
branchname => $branches->{$branchcode}->{branchname},
diff --git a/admin/aqbudget.pl b/admin/aqbudget.pl
index fccedae..0aa1cd4 100755
--- a/admin/aqbudget.pl
+++ b/admin/aqbudget.pl
@@ -275,7 +275,7 @@ SELECT bookfundid, bookfundname
# filters
my $branches = GetBranches();
my @branchloop;
- foreach my $branchcode (sort keys %{$branches}) {
+ foreach my $branchcode (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %{$branches}) {
my $row = {
code => $branchcode,
name => $branches->{$branchcode}->{branchname},
diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index f8780c2..b21f895 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -334,7 +334,7 @@ foreach my $tag (sort keys %{$tagslib}) {
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
- foreach my $thisbranch ( sort keys %$branches ) {
+ foreach my $thisbranch ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
push @authorised_values, $thisbranch;
$authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
}
diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl
index b97f27b..f57c95a 100755
--- a/cataloguing/value_builder/unimarc_field_4XX.pl
+++ b/cataloguing/value_builder/unimarc_field_4XX.pl
@@ -494,7 +494,7 @@ sub plugin {
my $branches = GetBranches;
push @select_branch, "";
$select_branches{''} = "";
- foreach my $thisbranch ( keys %$branches ) {
+ foreach my $thisbranch ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
push @select_branch, $branches->{$thisbranch}->{'branchcode'};
$select_branches{ $branches->{$thisbranch}->{'branchcode'} } =
$branches->{$thisbranch}->{'branchname'};
diff --git a/circ/bookcount.pl b/circ/bookcount.pl
index eeeff41..1c48fc5 100755
--- a/circ/bookcount.pl
+++ b/circ/bookcount.pl
@@ -72,7 +72,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my @branchloop;
-foreach my $branchcode ( keys %$branches ) {
+foreach my $branchcode ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %linebranch;
$linebranch{issues} = issuesat( $itm, $branchcode );
my $date = lastseenat( $itm, $branchcode );
diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl
index 36f4da3..a22b41f 100755
--- a/circ/branchtransfers.pl
+++ b/circ/branchtransfers.pl
@@ -105,7 +105,7 @@ if ( $request eq 'KillReserved' ) {
# set up the branchselect options....
my @branchoptionloop;
-foreach my $br ( keys %$branches ) {
+foreach my $br ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %branch;
$branch{selected} = ( $br eq $tobranchcd );
$branch{code} = $br;
diff --git a/circ/overdue.pl b/circ/overdue.pl
index 3797926..77cf754 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -96,7 +96,7 @@ my $onlymine=C4::Context->preference('IndependantBranches') &&
my $branches = GetBranches($onlymine);
my @branchloop;
-foreach my $thisbranch ( sort keys %$branches ) {
+foreach my $thisbranch ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %row = (
value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl
index f3cdd8d..59b0dac 100755
--- a/circ/transferstoreceive.pl
+++ b/circ/transferstoreceive.pl
@@ -59,7 +59,7 @@ my $default = C4::Context->userenv->{'branch'};
# get the all the branches for reference
my $branches = GetBranches();
my @branchesloop;
-foreach my $br ( keys %$branches ) {
+foreach my $br ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my @transferloop;
my %branchloop;
my @gettransfers =
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index ddccb84..c491f4a 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -118,7 +118,7 @@ if (C4::Context->preference('TagsEnabled')) {
my $branches = GetBranches();
my @branch_loop;
-for my $branch_hash (sort keys %$branches) {
+for my $branch_hash (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, };
}
diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl
index 3371d1d..c478928 100755
--- a/opac/opac-topissues.pl
+++ b/opac/opac-topissues.pl
@@ -97,7 +97,7 @@ $template->param(do_it => 1,
# load the branches ## again??
$branches = GetBranches();
my @branch_loop;
-for my $branch_hash (sort keys %$branches ) {
+for my $branch_hash (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my $selected=(C4::Context->userenv && ($branch_hash eq C4::Context->userenv->{branch})) if (C4::Context->preference('SearchMyLibraryFirst'));
push @branch_loop,
{
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 71b19b9..09ac4e6 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -174,7 +174,7 @@ $template->param( overdues_count => $overdues_count );
# load the branches
my $branches = GetBranches();
my @branch_loop;
-for my $branch_hash (sort keys %$branches ) {
+for my $branch_hash (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my $selected=(C4::Context->userenv && ($branch_hash eq C4::Context->userenv->{branch})) if (C4::Context->preference('SearchMyLibraryFirst'));
push @branch_loop,
{
diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl
index f134b9a..13ff10b 100755
--- a/reports/cat_issues_top.pl
+++ b/reports/cat_issues_top.pl
@@ -132,7 +132,7 @@ if ($do_it) {
#branch
my $branches = GetBranches;
my @branchloop;
- foreach my $thisbranch (keys %$branches) {
+ foreach my $thisbranch (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
# my $selected = 1 if $thisbranch eq $branch;
my %row =(value => $thisbranch,
# selected => $selected,
diff --git a/reports/catalogue_out.pl b/reports/catalogue_out.pl
index cfdde8d..ff7b1f1 100755
--- a/reports/catalogue_out.pl
+++ b/reports/catalogue_out.pl
@@ -125,7 +125,7 @@ foreach (keys %$itemtypes) {
}
my $branches = GetBranches;
my @branchloop;
-foreach (keys %$branches) {
+foreach (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
push @branchloop, {
value => $_,
# selected => ($_ eq $branch) ? 1 : 0,
diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl
index d624bdc..0fdab5e 100755
--- a/reports/catalogue_stats.pl
+++ b/reports/catalogue_stats.pl
@@ -149,7 +149,7 @@ if ($do_it) {
my $branches=GetBranches();
my @branchloop;
- foreach (keys %$branches) {
+ foreach (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
my $thisbranch = ''; # FIXME: populate $thisbranch to preselect one
my %row = (branchcode => $_,
selected => ($thisbranch eq $_ ? 1 : 0),
diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl
index 4710295..334bd87 100755
--- a/reports/issues_avg_stats.pl
+++ b/reports/issues_avg_stats.pl
@@ -166,7 +166,7 @@ if ($do_it) {
my %select_branches;
push @select_branch,"";
$select_branches{""} = "";
- foreach my $branch (keys %$branches) {
+ foreach my $branch (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
push @select_branch, $branch;
$select_branches{$branch} = $branches->{$branch}->{'branchname'};
}
diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl
index df848bd..f0a131f 100755
--- a/reports/issues_stats.pl
+++ b/reports/issues_stats.pl
@@ -139,7 +139,7 @@ for my $itype ( keys(%$itemtypes)) {
my $branches=GetBranches();
my @branchloop;
-foreach (keys %$branches) {
+foreach (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
my $thisbranch = ''; # FIXME
my %row = (
branchcode => $_,
diff --git a/reports/itemslost.pl b/reports/itemslost.pl
index c0482ab..a5d7329 100755
--- a/reports/itemslost.pl
+++ b/reports/itemslost.pl
@@ -71,7 +71,7 @@ if ( $get_items ) {
my $branches = GetBranches;
my $branch = C4::Context->userenv->{"branchname"};
my @branchloop;
-foreach my $thisbranch ( keys %$branches ) {
+foreach my $thisbranch (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my $selected = 1 if $thisbranch eq $branch;
my %row = (
value => $thisbranch,
diff --git a/reports/reservereport.pl b/reports/reservereport.pl
index fa38964..5dab08c 100755
--- a/reports/reservereport.pl
+++ b/reports/reservereport.pl
@@ -62,7 +62,7 @@ my %branchall;
my $branchcount=0;
my @branchloop;
-foreach my $br (keys %$branches) {
+foreach my $br (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
$branchcount++;
my %branch1;
$branch1{name}=$branches->{$br}->{'branchname'};
diff --git a/reserve/request.pl b/reserve/request.pl
index 5786ac8..41e989c 100755
--- a/reserve/request.pl
+++ b/reserve/request.pl
@@ -368,7 +368,7 @@ foreach my $res ( sort { $a->{found} cmp $b->{found} } @$reserves ) {
);
}
my @branchloop;
- foreach my $br ( keys %$branches ) {
+ foreach my $br ( sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches ) {
my %abranch;
$abranch{'selected'} = ( $br eq $res->{'branchcode'} );
$abranch{'branch'} = $br;
@@ -428,7 +428,7 @@ my $default = C4::Context->userenv->{branch};
my @values;
my %label_of;
-foreach my $branchcode (sort keys %{$branches} ) {
+foreach my $branchcode (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %{$branches} ) {
push @values, $branchcode;
$label_of{$branchcode} = $branches->{$branchcode}->{branchname};
}
diff --git a/serials/serials-recieve.pl b/serials/serials-recieve.pl
index 89e86be..b49a0b9 100755
--- a/serials/serials-recieve.pl
+++ b/serials/serials-recieve.pl
@@ -204,7 +204,7 @@ if (C4::Context->preference("serialsadditems")){
my $branches = GetBranches;
my @branchloop;
- foreach my $thisbranch (keys %$branches) {
+ foreach my $thisbranch (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
my $selected = 0;
if($thisbranch eq $solhistory->{'lastbranch'}){
$selected = 1;
diff --git a/tools/inventory.pl b/tools/inventory.pl
index a144b17..a1c8e0b 100755
--- a/tools/inventory.pl
+++ b/tools/inventory.pl
@@ -57,7 +57,7 @@ my ($template, $borrowernumber, $cookie)
my $branches = GetBranches();
my @branch_loop;
push @branch_loop, {value => "", branchname => "All Locations", };
-for my $branch_hash (keys %$branches) {
+for my $branch_hash (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
push @branch_loop, {value => "$branch_hash",
branchname => $branches->{$branch_hash}->{'branchname'},
selected => ($branch_hash eq $branchcode?1:0)};
--
1.6.0.2
More information about the Koha-patches
mailing list