Commit 51f3378e authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 328203: Cannot update a product if 'usetargetmilestone' is off (and the…

Bug 328203: Cannot update a product if 'usetargetmilestone' is off (and the default milestone has been previously changed) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=justdave
parent 4cde47cd
...@@ -820,15 +820,30 @@ if ($action eq 'update') { ...@@ -820,15 +820,30 @@ if ($action eq 'update') {
{product => $product_name}); {product => $product_name});
} }
# Only update milestone related stuff if 'usetargetmilestone' is on.
if (Param('usetargetmilestone')) {
my $milestone = new Bugzilla::Milestone($product_old->id, my $milestone = new Bugzilla::Milestone($product_old->id,
$defaultmilestone); $defaultmilestone);
if (!$milestone) {
unless ($milestone) {
ThrowUserError('prod_must_define_defaultmilestone', ThrowUserError('prod_must_define_defaultmilestone',
{product => $product_old->name, {product => $product_old->name,
defaultmilestone => $defaultmilestone, defaultmilestone => $defaultmilestone,
classification => $classification_name}); 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; $disallownew = $disallownew ? 1 : 0;
if ($disallownew ne $product_old->disallow_new) { if ($disallownew ne $product_old->disallow_new) {
$dbh->do('UPDATE products SET disallownew = ? WHERE id = ?', $dbh->do('UPDATE products SET disallownew = ? WHERE id = ?',
...@@ -841,13 +856,6 @@ if ($action eq 'update') { ...@@ -841,13 +856,6 @@ if ($action eq 'update') {
undef, ($description, $product_old->id)); 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) { if ($votesperuser ne $product_old->votes_per_user) {
$dbh->do('UPDATE products SET votesperuser = ? WHERE id = ?', $dbh->do('UPDATE products SET votesperuser = ? WHERE id = ?',
undef, ($votesperuser, $product_old->id)); undef, ($votesperuser, $product_old->id));
...@@ -866,12 +874,6 @@ if ($action eq 'update') { ...@@ -866,12 +874,6 @@ if ($action eq 'update') {
$checkvotes = 1; $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) { if ($product_name ne $product_old->name) {
trick_taint($product_name); trick_taint($product_name);
$dbh->do('UPDATE products SET name = ? WHERE id = ?', $dbh->do('UPDATE products SET name = ? WHERE id = ?',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment