summaryrefslogtreecommitdiffstats
path: root/enter_bug.cgi
diff options
context:
space:
mode:
authorRobert Webb <rowebb@gmail.com>2011-09-29 01:23:31 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-09-29 01:23:31 +0200
commit36478e4ed9e8b3f1e613a0829e4ee9f54c1f8f40 (patch)
tree864b5bc0b558b21c9c9c961104c54f3c8b0067f6 /enter_bug.cgi
parent720408cbfcdf37cdc50c89f25976a023e27bb93c (diff)
downloadbugzilla-36478e4ed9e8b3f1e613a0829e4ee9f54c1f8f40.tar.gz
bugzilla-36478e4ed9e8b3f1e613a0829e4ee9f54c1f8f40.tar.xz
Bug 512648 - Make Bugzilla::Bug centrally control available statuses in
enter_bug.cgi r=mkanat, a=mkanat
Diffstat (limited to 'enter_bug.cgi')
-rwxr-xr-xenter_bug.cgi26
1 files changed, 5 insertions, 21 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi
index 497209df4..4ef886741 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -342,27 +342,15 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) {
}
# Construct the list of allowable statuses.
-my @statuses = @{ Bugzilla::Status->can_change_to() };
+my @statuses = @{ Bugzilla::Bug->new_bug_statuses($product) };
# Exclude closed states from the UI, even if the workflow allows them.
# The back-end code will still accept them, though.
+# XXX We should remove this when the UI accepts closed statuses and update
+# Bugzilla::Bug->default_bug_status.
@statuses = grep { $_->is_open } @statuses;
-# UNCONFIRMED is illegal if allows_unconfirmed is false.
-if (!$product->allows_unconfirmed) {
- @statuses = grep { $_->name ne 'UNCONFIRMED' } @statuses;
-}
scalar(@statuses) || 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 ($unconfirmed) = grep { $_->name eq 'UNCONFIRMED' } @statuses;
-
- # Because of an apparent Perl bug, "$unconfirmed || $statuses[0]" doesn't
- # work, so we're using an "?:" operator. See bug 603314 for details.
- @statuses = ($unconfirmed ? $unconfirmed : $statuses[0]);
-}
-
$vars->{'bug_status'} = \@statuses;
# Get the default from a template value if it is legitimate.
@@ -372,12 +360,8 @@ $vars->{'bug_status'} = \@statuses;
my $picked_status = formvalue('bug_status');
if ($picked_status and grep($_->name eq $picked_status, @statuses)) {
$default{'bug_status'} = formvalue('bug_status');
-} elsif (scalar @statuses == 1) {
- $default{'bug_status'} = $statuses[0]->name;
-}
-else {
- $default{'bug_status'} = ($statuses[0]->name ne 'UNCONFIRMED')
- ? $statuses[0]->name : $statuses[1]->name;
+} else {
+ $default{'bug_status'} = Bugzilla::Bug->default_bug_status(@statuses);
}
my @groups = $cgi->param('groups');