diff options
author | lpsolit%gmail.com <> | 2006-07-17 08:22:32 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2006-07-17 08:22:32 +0200 |
commit | 6a688141978ccd79300218f48cce9a42e1ad1a91 (patch) | |
tree | d36348c98eae0300a20ce80df04de331ce9cbba9 /Bugzilla | |
parent | 324479e5c3f9fb77f85bfedee1e870f11076ee48 (diff) | |
download | bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.gz bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.xz |
Bug 277377: Classifications should support sort keys - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Classification.pm | 4 | ||||
-rw-r--r-- | Bugzilla/DB/Schema.pm | 1 | ||||
-rw-r--r-- | Bugzilla/User.pm | 3 |
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}; } |