summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorPami Ketolainen <pami.ketolainen@jollamobile.com>2013-04-16 12:14:23 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2013-04-16 12:14:23 +0200
commite6c6efd5b30f184ac22410808b3bb263eb00779a (patch)
tree73a32c48407fae63685fce06d7021319b649a4de /Bugzilla/Bug.pm
parent6b393ecc304b3c239eb0399b53e0c69b918b2334 (diff)
downloadbugzilla-e6c6efd5b30f184ac22410808b3bb263eb00779a.tar.gz
bugzilla-e6c6efd5b30f184ac22410808b3bb263eb00779a.tar.xz
Bug 782210: If a custom field depends on a product, component or classification, the "mandatory" bit is ignored on bug creation
r/a=LpSolit
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index cad024bbd..7b86ab2a1 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -730,6 +730,17 @@ sub run_create_validators {
my $class = shift;
my $params = $class->SUPER::run_create_validators(@_);
+ # Add classification for checking mandatory fields which depend on it
+ $params->{classification} = $params->{product}->classification->name;
+
+ my @mandatory_fields = @{ Bugzilla->fields({ is_mandatory => 1,
+ enter_bug => 1,
+ obsolete => 0 }) };
+ foreach my $field (@mandatory_fields) {
+ $class->_check_field_is_mandatory($params->{$field->name}, $field,
+ $params);
+ }
+
my $product = delete $params->{product};
$params->{product_id} = $product->id;
my $component = delete $params->{component};
@@ -754,18 +765,11 @@ sub run_create_validators {
delete $params->{resolution};
delete $params->{lastdiffed};
delete $params->{bug_id};
+ delete $params->{classification};
Bugzilla::Hook::process('bug_end_of_create_validators',
{ params => $params });
- my @mandatory_fields = @{ Bugzilla->fields({ is_mandatory => 1,
- enter_bug => 1,
- obsolete => 0 }) };
- foreach my $field (@mandatory_fields) {
- $class->_check_field_is_mandatory($params->{$field->name}, $field,
- $params);
- }
-
return $params;
}