From 589632e9d5d35c25c932aafa164feb92c26f5e3d Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 17 Aug 2011 13:05:31 +0200 Subject: Bug 661476: sanitycheck.pl should check if all products have components defined. Also, creating a new product from the web UI asks you to create a component too. r=glob a=LpSolit --- editproducts.cgi | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index 6d5c5e593..ed6596130 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -37,6 +37,7 @@ use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::Group; use Bugzilla::Product; +use Bugzilla::Component; use Bugzilla::Classification; use Bugzilla::Token; @@ -176,7 +177,13 @@ if ($action eq 'new') { check_token_data($token, 'add_product'); - my %create_params = ( + Bugzilla::User::match_field ({ + 'initialowner' => { 'type' => 'single' }, + 'initialqacontact' => { 'type' => 'single' }, + 'initialcc' => { 'type' => 'multi' }, + }); + + my %product_create_params = ( classification => $classification_name, name => $product_name, description => scalar $cgi->param('description'), @@ -186,7 +193,23 @@ if ($action eq 'new') { create_series => scalar $cgi->param('createseries'), allows_unconfirmed => scalar $cgi->param('allows_unconfirmed'), ); - my $product = Bugzilla::Product->create(\%create_params); + + $dbh->bz_start_transaction(); + my $product = Bugzilla::Product->create(\%product_create_params); + + my @initial_cc = $cgi->param('initialcc'); + my %component_create_params = ( + product => $product, + name => trim($cgi->param('component') || ''), + description => scalar $cgi->param('comp_desc'), + initialowner => scalar $cgi->param('initialowner'), + initialqacontact => scalar $cgi->param('initialqacontact'), + initial_cc => \@initial_cc, + create_series => scalar $cgi->param('createseries'), + ); + + Bugzilla::Component->create(\%component_create_params); + $dbh->bz_commit_transaction(); delete_token($token); -- cgit v1.2.3-24-g4f1b