aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/Field
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-10-25 04:11:30 +0000
committermkanat%bugzilla.org <>2008-10-25 04:11:30 +0000
commit3cea91884b28b52df4e38f2ba88c00b65071a81f (patch)
treec0f451235176b2b542a38b0c935dcddf0453a1ee /Bugzilla/Field
parente0da20baba17b7f068946c8647fb6d67e77c39b7 (diff)
downloadbugs-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar
bugs-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.gz
bugs-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.bz2
bugs-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.xz
bugs-3cea91884b28b52df4e38f2ba88c00b65071a81f.zip
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.pm12
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 #
############