From: Max Kanat-Alexander Date: Sun, 28 Mar 2010 21:37:28 +0000 (-0700) Subject: Bug 554569: WebService Bug.fields: Make it so that if you request a field X-Git-Tag: bugzilla-3.6~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d71a5955d23688f97f9586afa57f860da97c3831;p=thirdparty%2Fbugzilla.git Bug 554569: WebService Bug.fields: Make it so that if you request a field by both id and name, only one field is returned r=dkl, a=mkanat --- diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 07a8c7dd35..a249de05d8 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -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;