From 13e17b221c37a1eea1d86aec07b72ee70bf52487 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 22 Oct 2009 22:33:34 +0000 Subject: Bug 522396: Bugzilla::Product->create should do better with missing input fields Patch by Max Kanat-Alexander r=dkl, a=mkanat --- Bugzilla/Product.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 1db5e79b3..ddf60177d 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -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'}; -- cgit v1.2.3-24-g4f1b