summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Product.pm
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/Product.pm
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/Product.pm')
-rw-r--r--Bugzilla/Product.pm24
1 files changed, 23 insertions, 1 deletions
diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm
index 396aaa346..88292d27e 100644
--- a/Bugzilla/Product.pm
+++ b/Bugzilla/Product.pm
@@ -31,7 +31,9 @@ use Bugzilla::Install::Requirements;
use Bugzilla::Mailer;
use Bugzilla::Series;
-use base qw(Bugzilla::Object);
+# Currently, we only implement enough of the Bugzilla::Field::Choice
+# interface to control the visibility of other fields.
+use base qw(Bugzilla::Field::Choice);
use constant DEFAULT_CLASSIFICATION_ID => 1;
@@ -40,6 +42,10 @@ use constant DEFAULT_CLASSIFICATION_ID => 1;
###############################
use constant DB_TABLE => 'products';
+# Reset these back to the Bugzilla::Object defaults, instead of the
+# Bugzilla::Field::Choice defaults.
+use constant NAME_FIELD => 'name';
+use constant LIST_ORDER => 'name';
use constant DB_COLUMNS => qw(
id
@@ -372,6 +378,8 @@ sub remove_from_db {
$dbh->bz_start_transaction();
+ $self->_check_if_controller();
+
if ($self->bug_count) {
if (Bugzilla->params->{'allowbugdeletion'}) {
require Bugzilla::Bug;
@@ -523,6 +531,20 @@ sub _check_votes {
return $votes;
}
+#####################################
+# Implement Bugzilla::Field::Choice #
+#####################################
+
+sub field {
+ my $invocant = shift;
+ my $class = ref $invocant || $invocant;
+ my $cache = Bugzilla->request_cache;
+ $cache->{"field_$class"} ||= new Bugzilla::Field({ name => 'product' });
+ return $cache->{"field_$class"};
+}
+
+use constant is_default => 0;
+
###############################
#### Methods ####
###############################