From f65a3e7e20fdfe2f136ecdaa228f0784bb56b9ad Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sun, 8 Feb 2009 19:42:19 +0000 Subject: Bug 371995: Allow the Product field to restrict visibility of custom fields Patch By Max Kanat-Alexander r=LpSolit, a=mkanat --- Bugzilla/Field/Choice.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Field') diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm index 9e8fb1235..00fa52f99 100644 --- a/Bugzilla/Field/Choice.pm +++ b/Bugzilla/Field/Choice.pm @@ -62,6 +62,7 @@ use constant VALIDATORS => { use constant CLASS_MAP => { bug_status => 'Bugzilla::Status', + product => 'Bugzilla::Product', }; use constant DEFAULT_MAP => { @@ -189,6 +190,13 @@ sub remove_from_db { ThrowUserError("fieldvalue_still_has_bugs", { field => $self->field, value => $self }); } + $self->_check_if_controller(); + $self->SUPER::remove_from_db(); +} + +# Factored out to make life easier for subclasses. +sub _check_if_controller { + my $self = shift; my $vis_fields = $self->controls_visibility_of_fields; my $values = $self->controlled_values; if (@$vis_fields || @$values) { @@ -196,7 +204,6 @@ sub remove_from_db { { value => $self, fields => [map($_->name, @$vis_fields)], vals => $values }); } - $self->SUPER::remove_from_db(); } -- cgit v1.2.3-24-g4f1b