From: jocuri%softhome.net <> Date: Sun, 12 Dec 2004 09:41:09 +0000 (+0000) Subject: Patch for bug 273873: bug-creation template for UNCONFIRMED shouldn't set status... X-Git-Tag: bugzilla-2.18~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0afb29125fb4fddae2a060c0e1b4a203f647dd41;p=thirdparty%2Fbugzilla.git Patch for bug 273873: bug-creation template for UNCONFIRMED shouldn't set status to NEW; patch by Nick.Barnes@pobox.com, r=justdave, a=justdave. --- diff --git a/enter_bug.cgi b/enter_bug.cgi index cbe2929aa1..f51351599b 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -304,18 +304,38 @@ if (formvalue('version')) { $default{'version'} = $vars->{'version'}->[$#{$vars->{'version'}}]; } -# There must be at least one status in @status. -my @status = "NEW"; +# List of status values for drop-down. +my @status; -if (UserInGroup("editbugs") || UserInGroup("canconfirm")) { - SendSQL("SELECT votestoconfirm FROM products WHERE name = " . - SqlQuote($product)); - push(@status, $unconfirmedstate) if (FetchOneColumn()); +# Construct the list of allowable values. There are three cases: +# +# case values +# product does not have confirmation NEW +# confirmation, user cannot confirm UNCONFIRMED +# confirmation, user can confirm NEW, UNCONFIRMED. + +SendSQL("SELECT votestoconfirm FROM products WHERE name = " . + SqlQuote($product)); +if (FetchOneColumn()) { + if (UserInGroup("editbugs") || UserInGroup("canconfirm")) { + push(@status, "NEW"); + } + push(@status, $unconfirmedstate); +} else { + push(@status, "NEW"); } $vars->{'bug_status'} = \@status; -$default{'bug_status'} = $status[0]; +# Get the default from a template value if it is legitimate. +# Otherwise, set the default to the first item on the list. + +if (formvalue('bug_status') && (lsearch(\@status, formvalue('bug_status')) >= 0)) { + $default{'bug_status'} = formvalue('bug_status'); +} else { + $default{'bug_status'} = $status[0]; +} + SendSQL("SELECT DISTINCT groups.id, groups.name, groups.description, " . "membercontrol, othercontrol " . "FROM groups LEFT JOIN group_control_map " . diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 274e30ca70..d8954a2a39 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -70,12 +70,6 @@ function set_assign_to() {
-[% IF bug_status.size <= 1 %] - -[% END %] - - @@ -168,14 +162,18 @@ function set_assign_to() { -[% IF bug_status.size > 1 %] +[% IF bug_status.size <= 1 %] + + + +[% ELSE %] [% sel = { description => 'Initial State', name => 'bug_status' } %] [% INCLUDE select %] - +[% END %] -[% END %]
Initial State:[% default.bug_status FILTER html %]