summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Classification.pm4
-rw-r--r--Bugzilla/DB/Schema.pm1
-rw-r--r--Bugzilla/User.pm3
3 files changed, 6 insertions, 2 deletions
diff --git a/Bugzilla/Classification.pm b/Bugzilla/Classification.pm
index 63a826dc3..3d264b704 100644
--- a/Bugzilla/Classification.pm
+++ b/Bugzilla/Classification.pm
@@ -31,6 +31,7 @@ use constant DB_COLUMNS => qw(
classifications.id
classifications.name
classifications.description
+ classifications.sortkey
);
our $columns = join(", ", DB_COLUMNS);
@@ -122,6 +123,7 @@ sub products {
sub id { return $_[0]->{'id'}; }
sub name { return $_[0]->{'name'}; }
sub description { return $_[0]->{'description'}; }
+sub sortkey { return $_[0]->{'sortkey'}; }
###############################
#### Subroutines ####
@@ -131,7 +133,7 @@ sub get_all_classifications {
my $dbh = Bugzilla->dbh;
my $ids = $dbh->selectcol_arrayref(q{
- SELECT id FROM classifications ORDER BY name});
+ SELECT id FROM classifications ORDER BY sortkey, name});
my @classifications;
foreach my $id (@$ids) {
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 7c848bd5b..c885987bc 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -854,6 +854,7 @@ use constant ABSTRACT_SCHEMA => {
PRIMARYKEY => 1},
name => {TYPE => 'varchar(64)', NOTNULL => 1},
description => {TYPE => 'MEDIUMTEXT'},
+ sortkey => {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '0'},
],
INDEXES => [
classifications_name_idx => {FIELDS => ['name'],
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 67ada8e29..a5a502446 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -557,7 +557,8 @@ sub get_selectable_classifications {
$class->{$product->classification_id} ||=
new Bugzilla::Classification($product->classification_id);
}
- my @sorted_class = sort {lc($a->name) cmp lc($b->name)} (values %$class);
+ my @sorted_class = sort {$a->sortkey <=> $b->sortkey
+ || lc($a->name) cmp lc($b->name)} (values %$class);
$self->{selectable_classifications} = \@sorted_class;
return $self->{selectable_classifications};
}