From 05ba0f410667684c973f325b7140448ed3528e2c Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Sun, 28 Mar 2010 14:30:30 -0700 Subject: Bug 554560: WebService Bug.fields: Send visibility_values for all select-type fields (including built-in fields that don't support it yet), but don't send a single null in the array for fields that have no visibility values. r=dkl, a=mkanat --- Bugzilla/WebService/Bug.pm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Bugzilla/WebService/Bug.pm') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 69de15cfd..934c08e15 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -93,8 +93,7 @@ sub fields { foreach my $field (@fields) { my $visibility_field = $field->visibility_field ? $field->visibility_field->name : undef; - my $visibility_value = $field->visibility_value - ? $field->visibility_value->name : undef; + my $vis_value = $field->visibility_value; my $value_field = $field->value_field ? $field->value_field->name : undef; @@ -118,7 +117,10 @@ sub fields { display_name => $self->type('string', $field->description), is_on_bug_entry => $self->type('boolean', $field->enter_bug), visibility_field => $self->type('string', $visibility_field), - visibility_values => [$self->type('string', $visibility_value)], + visibility_values => [ + defined $vis_value ? $self->type('string', $vis_value->name) + : () + ], ); if ($has_values) { $field_data{value_field} = $self->type('string', $value_field); @@ -185,6 +187,7 @@ sub _legal_field_values { is_open => $self->type('boolean', $status->is_open), sortkey => $self->type('int', $status->sortkey), can_change_to => \@can_change_to, + visibility_values => [], }); } } @@ -192,13 +195,14 @@ sub _legal_field_values { else { my @values = Bugzilla::Field::Choice->type($field)->get_all(); foreach my $value (@values) { - my $visibility_value = $value->visibility_value; - my $vis_val_name = $visibility_value ? $visibility_value->name - : undef; + my $vis_val = $value->visibility_value; push(@result, { name => $self->type('string', $value->name), sortkey => $self->type('int' , $value->sortkey), - visibility_values => [$self->type('string', $vis_val_name)], + visibility_values => [ + defined $vis_val ? $self->type('string', $vis_val->name) + : () + ], }); } } -- cgit v1.2.3-24-g4f1b