From: lpsolit%gmail.com <> Date: Wed, 1 Mar 2006 06:09:46 +0000 (+0000) Subject: Bug 328203: Cannot update a product if 'usetargetmilestone' is off (and the default... X-Git-Tag: bugzilla-2.22~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f8afde4188d4b1740a8ca2bb22abc0ef11c2972;p=thirdparty%2Fbugzilla.git Bug 328203: Cannot update a product if 'usetargetmilestone' is off (and the default milestone has been previously changed) - Patch by Frédéric Buclin r=wicked a=justdave --- diff --git a/editproducts.cgi b/editproducts.cgi index 2b7c5dc5d5..d7a5fcd455 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -23,7 +23,7 @@ # Dawn Endico # Joe Robins # Gavin Shelley -# Fr��ic Buclin +# Frédéric Buclin # Greg Hendricks # Lance Larsh # @@ -818,13 +818,28 @@ if ($action eq 'update') { {product => $product_name}); } - my $milestone = new Bugzilla::Milestone($product_old->id, - $defaultmilestone); - if (!$milestone) { - ThrowUserError('prod_must_define_defaultmilestone', - {product => $product_old->name, - defaultmilestone => $defaultmilestone, - classification => $classification_name}); + # Only update milestone related stuff if 'usetargetmilestone' is on. + if (Param('usetargetmilestone')) { + my $milestone = new Bugzilla::Milestone($product_old->id, + $defaultmilestone); + + unless ($milestone) { + ThrowUserError('prod_must_define_defaultmilestone', + {product => $product_old->name, + defaultmilestone => $defaultmilestone, + classification => $classification_name}); + } + + if ($milestoneurl ne $product_old->milestone_url) { + trick_taint($milestoneurl); + $dbh->do('UPDATE products SET milestoneurl = ? WHERE id = ?', + undef, ($milestoneurl, $product_old->id)); + } + + if ($milestone->name ne $product_old->default_milestone) { + $dbh->do('UPDATE products SET defaultmilestone = ? WHERE id = ?', + undef, ($milestone->name, $product_old->id)); + } } $disallownew = $disallownew ? 1 : 0; @@ -839,13 +854,6 @@ if ($action eq 'update') { undef, ($description, $product_old->id)); } - if (Param('usetargetmilestone') - && ($milestoneurl ne $product_old->milestone_url)) { - trick_taint($milestoneurl); - $dbh->do('UPDATE products SET milestoneurl = ? WHERE id = ?', - undef, ($milestoneurl, $product_old->id)); - } - if ($votesperuser ne $product_old->votes_per_user) { $dbh->do('UPDATE products SET votesperuser = ? WHERE id = ?', undef, ($votesperuser, $product_old->id)); @@ -864,12 +872,6 @@ if ($action eq 'update') { $checkvotes = 1; } - if ($defaultmilestone ne $product_old->default_milestone) { - trick_taint($defaultmilestone); - $dbh->do('UPDATE products SET defaultmilestone = ? WHERE id = ?', - undef, ($defaultmilestone, $product_old->id)); - } - if ($product_name ne $product_old->name) { trick_taint($product_name); $dbh->do('UPDATE products SET name = ? WHERE id = ?',