summaryrefslogtreecommitdiffstats
path: root/editproducts.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'editproducts.cgi')
-rwxr-xr-xeditproducts.cgi42
1 files changed, 22 insertions, 20 deletions
diff --git a/editproducts.cgi b/editproducts.cgi
index dc288a54b..1101f3182 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -820,13 +820,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;
@@ -841,13 +856,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));
@@ -866,12 +874,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 = ?',