Commit 60720d6c authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 92515: Implement the ability to change the resolution of a bug without…

Bug 92515: Implement the ability to change the resolution of a bug without reopening it - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=myk
parent d9d7c1c4
...@@ -449,13 +449,6 @@ sub CheckCanChangeField { ...@@ -449,13 +449,6 @@ sub CheckCanChangeField {
{ {
return 1; return 1;
} }
# A resolution change is always accompanied by a status change. So, we
# always OK resolution changes; if they really can't do this, we will
# notice it when status is checked.
if ($field eq "resolution") {
return 1;
}
# END DO_NOT_CHANGE # END DO_NOT_CHANGE
# Allow anyone to change comments. # Allow anyone to change comments.
...@@ -1127,7 +1120,7 @@ SWITCH: for ($cgi->param('knob')) { ...@@ -1127,7 +1120,7 @@ SWITCH: for ($cgi->param('knob')) {
ChangeResolution(''); ChangeResolution('');
last SWITCH; last SWITCH;
}; };
/^resolve$/ && CheckonComment( "resolve" ) && do { /^(resolve|change_resolution)$/ && CheckonComment( "resolve" ) && do {
# Check here, because its the only place we require the resolution # Check here, because its the only place we require the resolution
check_field('resolution', scalar $cgi->param('resolution'), check_field('resolution', scalar $cgi->param('resolution'),
\@::settable_resolution); \@::settable_resolution);
...@@ -1144,11 +1137,14 @@ SWITCH: for ($cgi->param('knob')) { ...@@ -1144,11 +1137,14 @@ SWITCH: for ($cgi->param('knob')) {
} }
} }
# RESOLVED bugs should have no time remaining; if ($cgi->param('knob') eq 'resolve') {
# more time can be added for the VERIFY step, if needed. # RESOLVED bugs should have no time remaining;
_remove_remaining_time(); # more time can be added for the VERIFY step, if needed.
_remove_remaining_time();
ChangeStatus('RESOLVED');
}
ChangeStatus('RESOLVED');
ChangeResolution($cgi->param('resolution')); ChangeResolution($cgi->param('resolution'));
last SWITCH; last SWITCH;
}; };
...@@ -1221,20 +1217,10 @@ SWITCH: for ($cgi->param('knob')) { ...@@ -1221,20 +1217,10 @@ SWITCH: for ($cgi->param('knob')) {
ValidateBugID($duplicate, 'dup_id'); ValidateBugID($duplicate, 'dup_id');
$cgi->param('dup_id', $duplicate); $cgi->param('dup_id', $duplicate);
# Make sure the bug is not already marked as a dupe
# (may appear in race condition)
my $dupe_of =
$dbh->selectrow_array("SELECT dupe_of FROM duplicates
WHERE dupe = ?",
undef, $cgi->param('id'));
if ($dupe_of) {
ThrowUserError("dupe_entry_found", { dupe_of => $dupe_of });
}
# Make sure a loop isn't created when marking this bug # Make sure a loop isn't created when marking this bug
# as duplicate. # as duplicate.
my %dupes; my %dupes;
$dupe_of = $duplicate; my $dupe_of = $duplicate;
my $sth = $dbh->prepare('SELECT dupe_of FROM duplicates my $sth = $dbh->prepare('SELECT dupe_of FROM duplicates
WHERE dupe = ?'); WHERE dupe = ?');
...@@ -1699,13 +1685,13 @@ foreach my $id (@idlist) { ...@@ -1699,13 +1685,13 @@ foreach my $id (@idlist) {
SendSQL($query); SendSQL($query);
} }
# Check for duplicates if the bug is [re]open # Check for duplicates if the bug is [re]open or its resolution is changed.
SendSQL("SELECT resolution FROM bugs WHERE bug_id = $id"); SendSQL("SELECT resolution FROM bugs WHERE bug_id = $id");
my $resolution = FetchOneColumn(); my $resolution = FetchOneColumn();
if ($resolution eq '') { if ($resolution ne 'DUPLICATE') {
SendSQL("DELETE FROM duplicates WHERE dupe = $id"); SendSQL("DELETE FROM duplicates WHERE dupe = $id");
} }
my $newproduct_id = $oldhash{'product_id'}; my $newproduct_id = $oldhash{'product_id'};
if ($cgi->param('product') ne $cgi->param('dontchange')) { if ($cgi->param('product') ne $cgi->param('dontchange')) {
my $newproduct_id = get_product_id($cgi->param('product')); my $newproduct_id = get_product_id($cgi->param('product'));
...@@ -2068,6 +2054,11 @@ foreach my $id (@idlist) { ...@@ -2068,6 +2054,11 @@ foreach my $id (@idlist) {
} }
if ($duplicate) { if ($duplicate) {
# If the bug was already marked as a duplicate, remove
# the existing entry.
$dbh->do('DELETE FROM duplicates WHERE dupe = ?',
undef, $cgi->param('id'));
# Check to see if Reporter of this bug is reporter of Dupe # Check to see if Reporter of this bug is reporter of Dupe
SendSQL("SELECT reporter FROM bugs WHERE bug_id = " . SendSQL("SELECT reporter FROM bugs WHERE bug_id = " .
$cgi->param('id')); $cgi->param('id'));
......
...@@ -72,24 +72,9 @@ ...@@ -72,24 +72,9 @@
Resolve [% terms.bug %], changing Resolve [% terms.bug %], changing
<a href="page.cgi?id=fields.html#resolution">resolution</a> to <a href="page.cgi?id=fields.html#resolution">resolution</a> to
</label> </label>
<select name="resolution" [% PROCESS select_resolution %]
onchange="document.changeform.knob[[% knum %]].checked=true">
[% FOREACH r = bug.choices.resolution %] [% PROCESS duplicate %]
<option value="[% r FILTER html %]">[% resolution_descs.${r} FILTER html %]</option>
[% END %]
</select>
<br>
[% knum = knum + 1 %]
<input type="radio" id="knob-duplicate" name="knob" value="duplicate">
<label for="knob-duplicate">
Resolve [% terms.bug %], mark it as duplicate of [% terms.bug %] #
</label>
<input name="dup_id" size="6"
onchange="if (this.value != '')
{document.changeform.knob[[% knum %]].checked=true}">
<br>
[% knum = knum + 1 %]
[% IF bug.user.canedit %] [% IF bug.user.canedit %]
<input type="radio" id="knob-reassign" name="knob" value="reassign"> <input type="radio" id="knob-reassign" name="knob" value="reassign">
...@@ -135,6 +120,14 @@ ...@@ -135,6 +120,14 @@
[% ELSE %] [% ELSE %]
[% IF bug.resolution != "MOVED" || [% IF bug.resolution != "MOVED" ||
(bug.resolution == "MOVED" && bug.user.canmove) %] (bug.resolution == "MOVED" && bug.user.canmove) %]
<input type="radio" id="knob-change-resolution" name="knob" value="change_resolution">
<label for="knob-change-resolution">
Change <a href="page.cgi?id=fields.html#resolution">resolution</a> to
</label>
[% PROCESS select_resolution %]
[% PROCESS duplicate %]
<input type="radio" id="knob-reopen" name="knob" value="reopen"> <input type="radio" id="knob-reopen" name="knob" value="reopen">
<label for="knob-reopen"> <label for="knob-reopen">
Reopen [% terms.bug %] Reopen [% terms.bug %]
...@@ -162,7 +155,6 @@ ...@@ -162,7 +155,6 @@
[% END %] [% END %]
<input type="submit" value="Commit"> <input type="submit" value="Commit">
<input type="hidden" name="form_name" value="process_bug">
<p> <p>
<font size="+1"> <font size="+1">
<b> <b>
...@@ -186,3 +178,27 @@ ...@@ -186,3 +178,27 @@
[% END %] [% END %]
</p> </p>
[%# Common actions %]
[% BLOCK select_resolution %]
<select name="resolution"
onchange="document.changeform.knob[[% knum %]].checked=true">
[% FOREACH r = bug.choices.resolution %]
<option value="[% r FILTER html %]">[% resolution_descs.${r} FILTER html %]</option>
[% END %]
</select>
<br>
[% knum = knum + 1 %]
[% END %]
[% BLOCK duplicate %]
<input type="radio" id="knob-duplicate" name="knob" value="duplicate">
<label for="knob-duplicate">
Mark the [% terms.bug %] as duplicate of [% terms.bug %] #
</label>
<input name="dup_id" size="6"
onchange="if (this.value != '') {document.changeform.knob[[% knum %]].checked=true}">
<br>
[% knum = knum + 1 %]
[% END %]
...@@ -320,11 +320,6 @@ ...@@ -320,11 +320,6 @@
[% title = "Description Required" %] [% title = "Description Required" %]
You must provide a description of the [% terms.bug %]. You must provide a description of the [% terms.bug %].
[% ELSIF error == "dupe_entry_found" %]
[% title = "Already marked as duplicate" %]
This [% terms.bug %] has already been marked as a duplicate
of [% terms.bug %] [%+ dupe_of FILTER html %].
[% ELSIF error == "dupe_not_allowed" %] [% ELSIF error == "dupe_not_allowed" %]
[% title = "Cannot mark $terms.bugs as duplicates" %] [% title = "Cannot mark $terms.bugs as duplicates" %]
You cannot mark [% terms.bugs %] as duplicates when You cannot mark [% terms.bugs %] as duplicates when
......
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