Bug 81724 - sort custom fields on search form

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1284 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-06-22 16:18:45 +00:00
parent 8c2daa4fde
commit ec46971d00
2 changed files with 6 additions and 1 deletions

View File

@ -775,11 +775,16 @@ sub get_fields
my $criteria = shift || {};
my $cache = $class->cache_fields;
my @fields = values %{$cache->{id}};
my $sort = delete $criteria->{sort};
for my $k (keys %$criteria)
{
my %v = map { $_ => 1 } (ref $criteria->{$k} ? @{$criteria->{$k}} : $criteria->{$k});
@fields = grep { $v{$_->$k} } @fields;
}
if ($sort)
{
@fields = sort { $a->{sortkey} <=> $b->{sortkey} } @fields;
}
return @fields;
}

View File

@ -186,7 +186,7 @@ YAHOO.util.Event.addListener(window, 'load', function() {
<table>
<tr>
[% i = 0 %]
[% FOR f = Bugzilla.get_fields({ is_select => 1, obsolete => 0, custom => 1 }) %]
[% FOR f = Bugzilla.get_fields({ is_select => 1, obsolete => 0, custom => 1, sort => 1 }) %]
[% IF f.legal_value_names.size %]
[% IF i AND !(i % 4) %]
</tr>