]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 554569: WebService Bug.fields: Make it so that if you request a field
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:37:28 +0000 (14:37 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:37:28 +0000 (14:37 -0700)
by both id and name, only one field is returned
r=dkl, a=mkanat

Bugzilla/WebService/Bug.pm

index 07a8c7dd351e387e3910e872423beee996405c4c..a249de05d8f04b68bccea6d11e91a1a763013c1d 100644 (file)
@@ -79,14 +79,16 @@ sub fields {
         my $names = $params->{names};
         foreach my $field_name (@$names) {
             my $loop_field = Bugzilla::Field->check($field_name);
-            push(@fields, $loop_field); 
+            # Don't push in duplicate fields if we also asked for this field
+            # in "ids".
+            if (!grep($_->id == $loop_field->id, @fields)) {
+                push(@fields, $loop_field);
+            }
         }
     }
 
-    if (!defined $params->{ids}
-        and !defined $params->{names})
-    {
-        @fields = @{Bugzilla::Field->match({obsolete => 0})};
+    if (!defined $params->{ids} and !defined $params->{names}) {
+        @fields = Bugzilla->get_fields({ obsolete => 0 });
     }
 
     my @fields_out;