]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 790129: Bugzilla->fields returns fields in random order (the sortkey is ignored)
authorSimon Green <sgreen+mozilla@redhat.com>
Fri, 12 Oct 2012 19:59:47 +0000 (21:59 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 12 Oct 2012 19:59:47 +0000 (21:59 +0200)
r/a=LpSolit

Bugzilla.pm

index 25b0583898387568af1b6ebbb793c6fca0cce902..dacdb5f692d9a78fcc0bbb1940346cac7cd33242 100644 (file)
@@ -591,7 +591,8 @@ sub fields {
         }
     }
 
-    return $do_by_name ? \%requested : [values %requested];
+    return $do_by_name ? \%requested
+        : [sort { $a->sortkey <=> $b->sortkey || $a->name cmp $b->name } values %requested];
 }
 
 sub active_custom_fields {
@@ -855,7 +856,7 @@ in a hashref:
 =item C<by_name>
 
 If false (or not specified), this method will return an arrayref of
-the requested fields. The order of the returned fields is random.
+the requested fields.
 
 If true, this method will return a hashref of fields, where the keys
 are field names and the valules are L<Bugzilla::Field> objects.