summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-05-27 05:27:45 +0200
committerlpsolit%gmail.com <>2007-05-27 05:27:45 +0200
commit2bd57ce8e6f2c2bb59a99d825fc9d181ea2cb4a5 (patch)
tree6bd15d0b6062217eaf3e7f82eaff89f75715f702 /buglist.cgi
parent9e81bb0333048f6066610f66614a1ef163917137 (diff)
downloadbugzilla-2bd57ce8e6f2c2bb59a99d825fc9d181ea2cb4a5.tar.gz
bugzilla-2bd57ce8e6f2c2bb59a99d825fc9d181ea2cb4a5.tar.xz
Bug 344965: Fix process_bug.cgi and bug/* templates to work with custom bug status workflow - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi22
1 files changed, 20 insertions, 2 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 338017fa1..6d47b69f9 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -1139,8 +1139,26 @@ if ($dotweak) {
$vars->{'unconfirmedstate'} = 'UNCONFIRMED';
- $vars->{'bugstatuses'} = [ keys %$bugstatuses ];
-
+ # Convert bug statuses to their ID.
+ my @bug_statuses = map {$dbh->quote($_)} keys %$bugstatuses;
+ my $bug_status_ids =
+ $dbh->selectcol_arrayref('SELECT id FROM bug_status
+ WHERE value IN (' . join(', ', @bug_statuses) .')');
+
+ # This query collects new statuses which are common to all current bug statuses.
+ # It also accepts transitions where the bug status doesn't change.
+ $bug_status_ids =
+ $dbh->selectcol_arrayref('SELECT DISTINCT new_status
+ FROM status_workflow sw1
+ WHERE NOT EXISTS (SELECT * FROM status_workflow sw2
+ WHERE sw2.old_status != sw1.new_status
+ AND sw2.old_status IN (' . join(', ', @$bug_status_ids) . ')
+ AND NOT EXISTS (SELECT * FROM status_workflow sw3
+ WHERE sw3.new_status = sw1.new_status
+ AND sw3.old_status = sw2.old_status))');
+
+ $vars->{'current_bug_statuses'} = [keys %$bugstatuses];
+ $vars->{'new_bug_statuses'} = Bugzilla::Status->new_from_list($bug_status_ids);
# The groups to which the user belongs.
$vars->{'groups'} = GetGroups();