diff options
author | mkanat%bugzilla.org <> | 2008-10-25 06:11:30 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-10-25 06:11:30 +0200 |
commit | 3cea91884b28b52df4e38f2ba88c00b65071a81f (patch) | |
tree | c0f451235176b2b542a38b0c935dcddf0453a1ee /Bugzilla/Field | |
parent | e0da20baba17b7f068946c8647fb6d67e77c39b7 (diff) | |
download | bugzilla-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.gz bugzilla-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.xz |
Bug 291433: Ability to have custom fields whose visibility depends on the values of other fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bbaetz, a=mkanat
Diffstat (limited to 'Bugzilla/Field')
-rw-r--r-- | Bugzilla/Field/Choice.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm index dbdfea1a3..4da644f1d 100644 --- a/Bugzilla/Field/Choice.pm +++ b/Bugzilla/Field/Choice.pm @@ -186,6 +186,10 @@ sub remove_from_db { ThrowUserError("fieldvalue_still_has_bugs", { field => $self->field, value => $self }); } + if (my @vis_fields = @{ $self->controls_visibility_of_fields }) { + ThrowUserError('fieldvalue_is_controller', + { value => $self, fields => [map($_->name, @vis_fields)] }); + } $self->SUPER::remove_from_db(); } @@ -248,6 +252,14 @@ sub is_static { return 0; } +sub controls_visibility_of_fields { + my $self = shift; + $self->{controls_visibility_of_fields} ||= Bugzilla::Field->match( + { visibility_field_id => $self->field->id, + visibility_value_id => $self->id }); + return $self->{controls_visibility_of_fields}; +} + ############ # Mutators # ############ |