summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/DB/Schema.pm4
-rw-r--r--Bugzilla/Product.pm11
-rw-r--r--Bugzilla/WebService/Constants.pm1
-rw-r--r--extensions/BMO/Extension.pm25
-rw-r--r--template/en/default/global/user-error.html.tmpl5
5 files changed, 19 insertions, 27 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 41afaeacf..561aa3a4f 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1419,9 +1419,9 @@ use constant ABSTRACT_SCHEMA => {
COLUMN => 'id',
DELETE => 'SET NULL'}},
security_group_id => {TYPE => 'INT3',
+ NOTNULL => 1,
REFERENCES => {TABLE => 'groups',
- COLUMN => 'id',
- DELETE => 'SET NULL'}},
+ COLUMN => 'id'}},
],
INDEXES => [
products_name_idx => {FIELDS => ['name'],
diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm
index 9cf4bf397..3fc4db77f 100644
--- a/Bugzilla/Product.pm
+++ b/Bugzilla/Product.pm
@@ -70,6 +70,7 @@ use constant VALIDATORS => {
description => \&_check_description,
version => \&_check_version,
defaultmilestone => \&_check_default_milestone,
+ security_group_id => \&_check_security_group_id,
isactive => \&Bugzilla::Object::check_boolean,
create_series => \&Bugzilla::Object::check_boolean
};
@@ -395,6 +396,16 @@ sub _check_version {
return $version;
}
+sub _check_security_group_id {
+ my ($invocant, $id) = @_;
+
+ $id = trim($id);
+
+ ThrowUserError('product_must_have_security_group') unless $id;
+
+ return $id;
+}
+
sub _check_default_milestone {
my ($invocant, $milestone) = @_;
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm
index 93fddfc2b..e43918a43 100644
--- a/Bugzilla/WebService/Constants.pm
+++ b/Bugzilla/WebService/Constants.pm
@@ -184,6 +184,7 @@ use constant WS_ERROR_CODE => {
product_must_have_description => 703,
product_must_have_version => 704,
product_must_define_defaultmilestone => 705,
+ product_must_have_security_group => 706,
# Group errors are 800-900
empty_group_name => 800,
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 322d03769..817fd1d74 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -813,31 +813,6 @@ sub quicksearch_map {
}
}
-sub object_before_create {
- my ($self, $args) = @_;
- return unless $args->{class}->isa('Bugzilla::Product');
-
- my $cgi = Bugzilla->cgi;
- my $params = $args->{params};
- foreach my $field (qw( default_platform_id default_op_sys_id security_group_id )) {
- $params->{$field} = $cgi->param($field);
- }
-}
-
-sub object_end_of_set_all {
- my ($self, $args) = @_;
- my $object = $args->{object};
- return unless $object->isa('Bugzilla::Product');
-
- my $cgi = Bugzilla->cgi;
- my $params = $args->{params};
- foreach my $field (qw( default_platform_id default_op_sys_id security_group_id )) {
- my $value = $cgi->param($field);
- detaint_natural($value);
- $object->set($field, $value);
- }
-}
-
sub object_end_of_create {
my ($self, $args) = @_;
my $class = $args->{class};
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index c6efb5649..1ee33dd89 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1605,6 +1605,11 @@
[% admindocslinks = {'products.html' => 'Administering products'} %]
You must enter a description for this product.
+ [% ELSIF error == "product_must_have_security_group" %]
+ [% title = "Product needs Security Group" %]
+ [% admindocslinks = {'products.html' => 'Administering products'} %]
+ You must enter a default security group for this product.
+
[% ELSIF error == "product_must_have_version" %]
[% title = "Product needs Version" %]
[% admindocslinks = {'products.html' => 'Administering products',