Bug 13401 - sort branches alphabetically in admin/authorised_values.pl
This patch adds a sort of branches alphabetically by name in authorised values administration, like in many other pages.
Also replaces var $branch (too ambigus) by $branchcode.
Test plan :
- Create 2 branches : code=AAA,name=Zbranch and code=ZZZ,name=Abranch
- Create a new authorized value : admin/authorised_values.pl
- Look at "Libraries limitation" :
=> Without patch branches are sorted by code : Zbranch then Abranch
=> Without patch branches are sorted by name : Abranch then Zbranch
- Select a branch and save
- Re-edit
=> Check the same branch is selected
Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
(cherry picked from commit 771c294c74)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
99f75b9478
commit
3ab9c7c93b
|
|
@ -85,11 +85,11 @@ if ($op eq 'add_form') {
|
|||
my $branches = GetBranches;
|
||||
my @branches_loop;
|
||||
|
||||
foreach my $branch (sort keys %$branches) {
|
||||
my $selected = ( grep {$_->{branchcode} eq $branch} @selected_branches ) ? 1 : 0;
|
||||
foreach my $branchcode ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches ) {
|
||||
my $selected = ( grep {$_->{branchcode} eq $branchcode} @selected_branches ) ? 1 : 0;
|
||||
push @branches_loop, {
|
||||
branchcode => $branches->{$branch}{branchcode},
|
||||
branchname => $branches->{$branch}{branchname},
|
||||
branchcode => $branchcode,
|
||||
branchname => $branches->{$branchcode}->{branchname},
|
||||
selected => $selected,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue