From a0d0ee270e7723f335945ec1ce09dd8efa65ff89 Mon Sep 17 00:00:00 2001 From: "travis%sedsystems.ca" <> Date: Sat, 26 Feb 2005 01:10:32 +0000 Subject: Bug 36257 : Have the QA Contact field appear in New Bug submission form Patch by Shane H. W. Travis r=LpSolit a=justdave --- enter_bug.cgi | 26 +++++++----- post_bug.cgi | 14 +++++-- template/en/default/bug/create/create.html.tmpl | 53 +++++++++++++++++++++---- 3 files changed, 74 insertions(+), 19 deletions(-) diff --git a/enter_bug.cgi b/enter_bug.cgi index 0dca344ed..f51a1c076 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -310,19 +310,24 @@ elsif (1 == @{$::components{$product}}) { } my @components; -SendSQL("SELECT name, description, login_name, realname - FROM components, profiles - WHERE product_id = $product_id - AND initialowner=userid - ORDER BY name"); -while (MoreSQLData()) { - my ($name, $description, $login, $realname) = FetchSQLData(); +my $dbh = Bugzilla->dbh; +my $sth = $dbh->prepare( + q{SELECT name, description, p1.login_name, p2.login_name + FROM components + LEFT JOIN profiles p1 ON components.initialowner = p1.userid + LEFT JOIN profiles p2 ON components.initialqacontact = p2.userid + WHERE product_id = ? + ORDER BY name}); + +$sth->execute($product_id); +while (my ($name, $description, $owner, $qacontact) + = $sth->fetchrow_array()) { push @components, { name => $name, description => $description, - default_login => $login, - default_realname => $realname, + initialowner => $owner, + initialqacontact => $qacontact || '', }; } @@ -342,6 +347,9 @@ $vars->{'assigned_to'} = formvalue('assigned_to'); $vars->{'assigned_to_disabled'} = !UserInGroup('editbugs'); $vars->{'cc_disabled'} = 0; +$vars->{'qa_contact'} = formvalue('qa_contact'); +$vars->{'qa_contact_disabled'} = !UserInGroup('editbugs'); + $vars->{'cloned_bug_id'} = $cloned_bug_id; if ($cloned_bug_id) { diff --git a/post_bug.cgi b/post_bug.cgi index 4f545fbb2..6b52b447d 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -63,6 +63,7 @@ my $dbh = Bugzilla->dbh; &Bugzilla::User::match_field ({ 'cc' => { 'type' => 'multi' }, 'assigned_to' => { 'type' => 'single' }, + 'qa_contact' => { 'type' => 'single' }, }); # The format of the initial comment can be structured by adding fields to the @@ -142,10 +143,17 @@ my @bug_fields = ("version", "rep_platform", "bug_status", "bug_file_loc", "short_desc", "target_milestone", "status_whiteboard"); +# Retrieve the default QA contact if the field is empty if (Param("useqacontact")) { - SendSQL("SELECT initialqacontact FROM components " . - "WHERE id = $component_id"); - my $qa_contact = FetchOneColumn(); + my $qa_contact; + if (!UserInGroup("editbugs") || trim($::FORM{'qa_contact'}) eq "") { + SendSQL("SELECT initialqacontact FROM components " . + "WHERE id = $component_id"); + $qa_contact = FetchOneColumn(); + } else { + $qa_contact = DBNameToIdAndCheck(trim($::FORM{'qa_contact'})); + } + if (defined $qa_contact && $qa_contact != 0) { $::FORM{'qa_contact'} = $qa_contact; push(@bug_fields, "qa_contact"); diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index d5ea69bdb..ce5aaa922 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -34,20 +34,34 @@