From 4c6220713993545fe6446a6853ca2ee66df32187 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Sun, 28 Mar 2010 14:26:37 -0700 Subject: Bug 554536: [WebService] Make Bug.fields not send the "values" item for fields that don't have a list of values r=dkl, a=mkanat --- Bugzilla/WebService/Bug.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index d81bc2792..69de15cfd 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -98,10 +98,11 @@ sub fields { my $value_field = $field->value_field ? $field->value_field->name : undef; - my @values; + my (@values, $has_values); if ( ($field->is_select and $field->name ne 'product') or grep($_ eq $field->name, PRODUCT_SPECIFIC_FIELDS)) { + $has_values = 1; @values = @{ $self->_legal_field_values({ field => $field }) }; } @@ -109,7 +110,7 @@ sub fields { $value_field = 'product'; } - push (@fields_out, filter $params, { + my %field_data = ( id => $self->type('int', $field->id), type => $self->type('int', $field->type), is_custom => $self->type('boolean', $field->custom), @@ -118,9 +119,12 @@ sub fields { is_on_bug_entry => $self->type('boolean', $field->enter_bug), visibility_field => $self->type('string', $visibility_field), visibility_values => [$self->type('string', $visibility_value)], - value_field => $self->type('string', $value_field), - values => \@values, - }); + ); + if ($has_values) { + $field_data{value_field} = $self->type('string', $value_field); + $field_data{values} = \@values; + }; + push(@fields_out, filter $params, \%field_data); } return { fields => \@fields_out }; -- cgit v1.2.3-24-g4f1b