aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-03-01 06:06:34 +0000
committerlpsolit%gmail.com <>2006-03-01 06:06:34 +0000
commit51f3378e9184eb656fc0382f69158be0bb251441 (patch)
tree3516758a540a4c0d035d66e84036a02e07ac8b37 /editproducts.cgi
parentFix ThrowCodeError calls by giving them an unique ID (tree fix). (diff)
downloadbugzilla-51f3378e9184eb656fc0382f69158be0bb251441.tar.gz
bugzilla-51f3378e9184eb656fc0382f69158be0bb251441.tar.bz2
bugzilla-51f3378e9184eb656fc0382f69158be0bb251441.zip
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
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 = ?',