From 7cae809aa26c1f1ac92fb3eb979c38b22fb95d52 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Jan 2016 10:02:06 +0000 Subject: [PATCH] [PASSED QA] Bug 15354: Sort itemtypes by translated description everywhere on circ rules admin page It's better to cmp on lc. Signed-off-by: Jesse Weaver Passes QA tools. Fixes sorting of dropdown for translated itemtype descriptions. Signed-off-by: Katrin Fischer --- admin/smart-rules.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 8221a0d..5be4c0a 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -440,6 +440,7 @@ while (my $data=$sth->fetchrow_hashref){ $sth->finish; my @row_loop; my @itemtypes = @{ GetItemTypes( style => 'array' ) }; +@itemtypes = sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @itemtypes; my $sth2 = $dbh->prepare(" SELECT issuingrules.*, @@ -543,7 +544,7 @@ my @branch_item_rules = (); while (my $row = $sth_branch_item->fetchrow_hashref) { push @branch_item_rules, $row; } -my @sorted_branch_item_rules = sort { $a->{translated_description} cmp $b->{translated_description} } @branch_item_rules; +my @sorted_branch_item_rules = sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @branch_item_rules; # note undef holdallowed so that template can deal with them foreach my $entry (@sorted_branch_item_rules) { @@ -622,6 +623,6 @@ sub by_itemtype { } elsif ($b->{'default_translated_description'}) { return -1; } else { - return $a->{'translated_description'} cmp $b->{'translated_description'}; + return lc $a->{'translated_description'} cmp lc $b->{'translated_description'}; } } -- 1.9.1