aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-17 13:05:31 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-17 13:05:31 +0200
commit589632e9d5d35c25c932aafa164feb92c26f5e3d (patch)
treea91df977bac1818f8a70fb7e758576a294a7221e /editproducts.cgi
parentBug 298268: editparams.cgi should accept urlbase, sslbase, etc.. with or with... (diff)
downloadbugzilla-589632e9d5d35c25c932aafa164feb92c26f5e3d.tar.gz
bugzilla-589632e9d5d35c25c932aafa164feb92c26f5e3d.tar.bz2
bugzilla-589632e9d5d35c25c932aafa164feb92c26f5e3d.zip
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
Diffstat (limited to 'editproducts.cgi')
-rwxr-xr-xeditproducts.cgi27
1 files changed, 25 insertions, 2 deletions
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);