summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Field
diff options
context:
space:
mode:
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 #
############