]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 522396: Bugzilla::Product->create should do better with missing input fields
authormkanat%bugzilla.org <>
Thu, 22 Oct 2009 22:33:34 +0000 (22:33 +0000)
committermkanat%bugzilla.org <>
Thu, 22 Oct 2009 22:33:34 +0000 (22:33 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat

Bugzilla/Product.pm

index 1db5e79b3276fd65000a664d7898e831c22d4095..ddf60177d913b7fe067b6bfb458e024f081c08a0 100644 (file)
@@ -105,7 +105,9 @@ sub create {
 
     my $params = $class->run_create_validators(@_);
     # Some fields do not exist in the DB as is.
-    $params->{classification_id} = delete $params->{classification};
+    if (defined $params->{classification}) {
+        $params->{classification_id} = delete $params->{classification}; 
+    }
     my $version = delete $params->{version};
     my $create_series = delete $params->{create_series};
 
@@ -113,7 +115,8 @@ sub create {
 
     # Add the new version and milestone into the DB as valid values.
     Bugzilla::Version->create({name => $version, product => $product});
-    Bugzilla::Milestone->create({name => $params->{defaultmilestone}, product => $product});
+    Bugzilla::Milestone->create({ name => $product->default_milestone, 
+                                  product => $product });
 
     # Create groups and series for the new product, if requested.
     $product->_create_bug_group() if Bugzilla->params->{'makeproductgroups'};