summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-03-28 23:36:11 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-03-28 23:36:11 +0200
commit6463e47b80e29c2c9a8e6b9671fe94331a39cf0f (patch)
tree3624aada37cd64e9e039c17c97b1bc4add3e9658
parent05ba0f410667684c973f325b7140448ed3528e2c (diff)
downloadbugzilla-6463e47b80e29c2c9a8e6b9671fe94331a39cf0f.tar.gz
bugzilla-6463e47b80e29c2c9a8e6b9671fe94331a39cf0f.tar.xz
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
-rw-r--r--Bugzilla/WebService/Bug.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 934c08e15..240eee91e 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;