aboutsummaryrefslogtreecommitdiffstats
path: root/enter_bug.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-06-14 21:25:41 +0000
committerlpsolit%gmail.com <>2007-06-14 21:25:41 +0000
commit80c5b6fadda4e77e5a48cd50e55cbe710a31ca83 (patch)
tree3c0e225a4810e080b2bc7f8ff3dc10485b92b267 /enter_bug.cgi
parent836b976e508db4efa1775d0beb0704cb56f28695 (diff)
downloadbugs-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar
bugs-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar.gz
bugs-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar.bz2
bugs-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar.xz
bugs-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.zip
Bug 344964: enter_bug.cgi should look at the custom status workflow to get the valid initial bug statuses - Patch by Frédéric Buclin <LpSolit@gmail.com> r=gerv a=justdave
Diffstat (limited to 'enter_bug.cgi')
-rwxr-xr-xenter_bug.cgi38
1 files changed, 17 insertions, 21 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi
index c802c0096..d4ee73bfb 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -49,6 +49,7 @@ use Bugzilla::Classification;
use Bugzilla::Keyword;
use Bugzilla::Token;
use Bugzilla::Field;
+use Bugzilla::Status;
my $user = Bugzilla->login(LOGIN_REQUIRED);
@@ -494,29 +495,24 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) {
}
# Construct the list of allowable statuses.
-#
-# * If the product requires votes to confirm:
-# users with privs : NEW + ASSI + UNCO
-# users with no privs: UNCO
-#
-# * If the product doesn't require votes to confirm:
-# users with privs : NEW + ASSI
-# users with no privs: NEW (as these users cannot reassign
-# bugs to them, it doesn't make sense
-# to let them mark bugs as ASSIGNED)
-
-my @status;
-if ($has_editbugs || $has_canconfirm) {
- @status = ('NEW', 'ASSIGNED');
-}
-elsif (!$product->votes_to_confirm) {
- @status = ('NEW');
-}
-if ($product->votes_to_confirm) {
- push(@status, 'UNCONFIRMED');
+my $initial_statuses = Bugzilla::Status->can_change_to();
+# Exclude closed states from the UI, even if the workflow allows them.
+# The back-end code will still accept them, though.
+@$initial_statuses = grep { $_->is_open } @$initial_statuses;
+
+my @status = map { $_->name } @$initial_statuses;
+# UNCONFIRMED is illegal if votes_to_confirm = 0.
+@status = grep {$_ ne 'UNCONFIRMED'} @status unless $product->votes_to_confirm;
+scalar(@status) || ThrowUserError('no_initial_bug_status');
+
+# If the user has no privs...
+unless ($has_editbugs || $has_canconfirm) {
+ # ... use UNCONFIRMED if available, else use the first status of the list.
+ my $bug_status = (grep {$_ eq 'UNCONFIRMED'} @status) ? 'UNCONFIRMED' : $status[0];
+ @status = ($bug_status);
}
-$vars->{'bug_status'} = \@status;
+$vars->{'bug_status'} = \@status;
# Get the default from a template value if it is legitimate.
# Otherwise, set the default to the first item on the list.