From: mkanat%bugzilla.org <> Date: Thu, 22 Oct 2009 22:33:34 +0000 (+0000) Subject: Bug 522396: Bugzilla::Product->create should do better with missing input fields X-Git-Tag: bugzilla-3.5.1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13e17b221c37a1eea1d86aec07b72ee70bf52487;p=thirdparty%2Fbugzilla.git Bug 522396: Bugzilla::Product->create should do better with missing input fields Patch by Max Kanat-Alexander r=dkl, a=mkanat --- diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 1db5e79b32..ddf60177d9 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'};