summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Field
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-02-08 20:42:19 +0100
committermkanat%bugzilla.org <>2009-02-08 20:42:19 +0100
commitf65a3e7e20fdfe2f136ecdaa228f0784bb56b9ad (patch)
tree276bfe21eed5f29153cd15f1f7a16846b8709956 /Bugzilla/Field
parent88463d2b267baefbfc788f192ffa9f08ea972d51 (diff)
downloadbugzilla-f65a3e7e20fdfe2f136ecdaa228f0784bb56b9ad.tar.gz
bugzilla-f65a3e7e20fdfe2f136ecdaa228f0784bb56b9ad.tar.xz
Bug 371995: Allow the Product field to restrict visibility of custom fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
Diffstat (limited to 'Bugzilla/Field')
-rw-r--r--Bugzilla/Field/Choice.pm9
1 files changed, 8 insertions, 1 deletions
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();
}