diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-28 14:30:30 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-28 14:30:30 -0700 |
commit | 05ba0f410667684c973f325b7140448ed3528e2c (patch) | |
tree | eecdb4fa7a5c8d70ef18c1eaa74dfb2dc6beaa4c /Bugzilla | |
parent | 4c6220713993545fe6446a6853ca2ee66df32187 (diff) | |
download | bugs-05ba0f410667684c973f325b7140448ed3528e2c.tar bugs-05ba0f410667684c973f325b7140448ed3528e2c.tar.gz bugs-05ba0f410667684c973f325b7140448ed3528e2c.tar.bz2 bugs-05ba0f410667684c973f325b7140448ed3528e2c.tar.xz bugs-05ba0f410667684c973f325b7140448ed3528e2c.zip |
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
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/WebService/Bug.pm | 18 |
1 files changed, 11 insertions, 7 deletions
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) + : () + ], }); } } |