Commit 93f43381 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 325048: [PostgreSQL] Changing the status of a bug from UNCONFIRMED to NEW or…

Bug 325048: [PostgreSQL] Changing the status of a bug from UNCONFIRMED to NEW or ASSIGNED sets everconfirmed to 1 but leave the status as UNCONFIRMED - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
parent 10272c25
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# Christopher Aillon <christopher@aillon.com> # Christopher Aillon <christopher@aillon.com>
# Myk Melez <myk@mozilla.org> # Myk Melez <myk@mozilla.org>
# Jeff Hedlund <jeff.hedlund@matrixsi.com> # Jeff Hedlund <jeff.hedlund@matrixsi.com>
# Frédéric Buclin <LpSolit@gmail.com> # Frédéric Buclin <LpSolit@gmail.com>
# Lance Larsh <lance.larsh@oracle.com> # Lance Larsh <lance.larsh@oracle.com>
# Implementation notes for this file: # Implementation notes for this file:
...@@ -742,10 +742,14 @@ sub DoComma { ...@@ -742,10 +742,14 @@ sub DoComma {
$::comma = ","; $::comma = ",";
} }
# $everconfirmed is used by ChangeStatus() to determine whether we are
# confirming the bug or not.
my $everconfirmed;
sub DoConfirm { sub DoConfirm {
if (CheckCanChangeField("canconfirm", scalar $cgi->param('id'), 0, 1)) { if (CheckCanChangeField("canconfirm", scalar $cgi->param('id'), 0, 1)) {
DoComma(); DoComma();
$::query .= "everconfirmed = 1"; $::query .= "everconfirmed = 1";
$everconfirmed = 1;
} }
} }
...@@ -787,11 +791,18 @@ sub ChangeStatus { ...@@ -787,11 +791,18 @@ sub ChangeStatus {
my @open_state = map(SqlQuote($_), OpenStates()); my @open_state = map(SqlQuote($_), OpenStates());
my $open_state = join(", ", @open_state); my $open_state = join(", ", @open_state);
# If we are changing everconfirmed to 1, we have to take this change
# into account and the new bug status is given by $str.
my $cond = SqlQuote($str);
# If we are not setting everconfirmed, the new bug status depends on
# the actual value of everconfirmed, which is bug-specific.
unless ($everconfirmed) {
$cond = "(CASE WHEN everconfirmed = 1 THEN " . $cond .
" ELSE 'UNCONFIRMED' END)";
}
$::query .= "bug_status = CASE WHEN bug_status IN($open_state) THEN " . $::query .= "bug_status = CASE WHEN bug_status IN($open_state) THEN " .
"(CASE WHEN everconfirmed = 1 THEN " . $cond . " ELSE bug_status END";
SqlQuote($str) . " ELSE " .
" 'UNCONFIRMED' END) ELSE " .
"bug_status END";
} else { } else {
$::query .= "bug_status = " . SqlQuote($str); $::query .= "bug_status = " . SqlQuote($str);
} }
......
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