Commit 146d47f6 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 238819: enter_bug.cgi should offer ASSIGNED as a possible initial state -…

Bug 238819: enter_bug.cgi should offer ASSIGNED as a possible initial state - Patch by Frédéric Buclin <LpSolit@gmail.com> r=vladd a=justdave
parent fe1d0e18
...@@ -438,24 +438,27 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) { ...@@ -438,24 +438,27 @@ 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)
# List of status values for drop-down.
my @status; my @status;
if ($user->in_group('editbugs') || $user->in_group('canconfirm')) {
# Construct the list of allowable values. There are three cases: @status = ('NEW', 'ASSIGNED');
# }
# case values elsif (!$product->votes_to_confirm) {
# product does not have confirmation NEW @status = ('NEW');
# confirmation, user cannot confirm UNCONFIRMED }
# confirmation, user can confirm NEW, UNCONFIRMED.
if ($product->votes_to_confirm) { if ($product->votes_to_confirm) {
if (UserInGroup("editbugs") || UserInGroup("canconfirm")) {
push(@status, "NEW");
}
push(@status, 'UNCONFIRMED'); push(@status, 'UNCONFIRMED');
} else {
push(@status, "NEW");
} }
$vars->{'bug_status'} = \@status; $vars->{'bug_status'} = \@status;
......
...@@ -202,17 +202,24 @@ if (Bugzilla->params->{"useqacontact"}) { ...@@ -202,17 +202,24 @@ if (Bugzilla->params->{"useqacontact"}) {
} }
} }
# Check the bug status.
# This order is important, see below.
my @valid_statuses = ('UNCONFIRMED', 'NEW', 'ASSIGNED');
my $bug_status = 'UNCONFIRMED'; my $bug_status = 'UNCONFIRMED';
if ($product->votes_to_confirm) { if ($user->in_group('editbugs') || $user->in_group('canconfirm')) {
# Default to NEW if the user with privs hasn't selected another status. # Default to NEW if the user with privs hasn't selected another status.
if (UserInGroup('editbugs') || UserInGroup('canconfirm')) { $bug_status = scalar($cgi->param('bug_status')) || 'NEW';
$bug_status = scalar($cgi->param('bug_status')) || 'NEW'; }
} elsif (!$product->votes_to_confirm) {
} else {
$bug_status = 'NEW'; $bug_status = 'NEW';
} }
$cgi->param(-name => 'bug_status', -value => $bug_status); $cgi->param(-name => 'bug_status', -value => $bug_status);
# Reject 'UNCONFIRMED' as a valid status if the product
# doesn't require votes to confirm its bugs.
shift @valid_statuses if !$product->votes_to_confirm;
if (!defined $cgi->param('target_milestone')) { if (!defined $cgi->param('target_milestone')) {
$cgi->param(-name => 'target_milestone', -value => $product->default_milestone); $cgi->param(-name => 'target_milestone', -value => $product->default_milestone);
} }
...@@ -226,7 +233,7 @@ check_field('rep_platform', scalar $cgi->param('rep_platform')); ...@@ -226,7 +233,7 @@ check_field('rep_platform', scalar $cgi->param('rep_platform'));
check_field('bug_severity', scalar $cgi->param('bug_severity')); check_field('bug_severity', scalar $cgi->param('bug_severity'));
check_field('priority', scalar $cgi->param('priority')); check_field('priority', scalar $cgi->param('priority'));
check_field('op_sys', scalar $cgi->param('op_sys')); check_field('op_sys', scalar $cgi->param('op_sys'));
check_field('bug_status', scalar $cgi->param('bug_status'), ['UNCONFIRMED', 'NEW']); check_field('bug_status', scalar $cgi->param('bug_status'), \@valid_statuses);
check_field('version', scalar $cgi->param('version'), check_field('version', scalar $cgi->param('version'),
[map($_->name, @{$product->versions})]); [map($_->name, @{$product->versions})]);
check_field('target_milestone', scalar $cgi->param('target_milestone'), check_field('target_milestone', scalar $cgi->param('target_milestone'),
......
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