From 964e18e4729d8c8b2e4a9d19979e0ab5db9ce43d Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 9 Mar 2009 13:51:58 -0500 Subject: [PATCH] Sort collection codes by description for dropdown. Collection code descriptions were otherwise displaying in an unsorted order. The result was not readable for any sufficiently large number of ccodes. Signed-off-by: Galen Charlton --- reports/catalogue_stats.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index c5d5ce0198..6ce41a4f2b 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -19,6 +19,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +# use warnings; # FIXME use C4::Auth; use CGI; use C4::Context; @@ -51,7 +52,7 @@ my $cotedigits = $input->param("cotedigits"); my $output = $input->param("output"); my $basename = $input->param("basename"); my $mime = $input->param("MIME"); -our $sep = $input->param("sep"); +our $sep = $input->param("sep"); $sep = "\t" if ($sep eq 'tabulation'); my ($template, $borrowernumber, $cookie) @@ -133,16 +134,16 @@ if ($do_it) { # No need to test for data here. If you don't have itemcallnumbers, you probably know it. # FIXME: Hardcoding to 5 chars on itemcallnum. # - my $hascote = 1; - my $highcote = 5; - + my $hascote = 1; + my $highcote = 5; + $req = $dbh->prepare("select itemtype, description from itemtypes order by description"); $req->execute; my $CGIitemtype = $req->fetchall_arrayref({}); my $authvals = GetKohaAuthorisedValues("items.ccode"); my @authvals; - foreach (keys %$authvals) { + foreach (sort {$authvals->{$a} cmp $authvals->{$b} || $a cmp $b} keys %$authvals) { push @authvals, { code => $_, description => $authvals->{$_} }; } -- 2.39.2