From 14ded6f71d1934c60754bc0de48ca9251a75bcce Mon Sep 17 00:00:00 2001 From: "bzrmirror%bugzilla.org" Date: Thu, 2 Jan 2014 22:15:42 +0000 Subject: [PATCH] Bug 940010 - When entering a new bug, if there's only one active version or component, automatically select it r=LpSolit, a=sgreen git-svn-id: svn://10.0.0.236/trunk@265159 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/enter_bug.cgi | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index 5a30a426d64..96fbcf8b929 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8843 \ No newline at end of file +8844 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/enter_bug.cgi b/mozilla/webtools/bugzilla/enter_bug.cgi index a609a2b9a59..1769b464c09 100755 --- a/mozilla/webtools/bugzilla/enter_bug.cgi +++ b/mozilla/webtools/bugzilla/enter_bug.cgi @@ -149,9 +149,16 @@ if ($cloned_bug_id) { $cloned_bug_id = $cloned_bug->id; } -if (scalar(@{$product->components}) == 1) { - # Only one component; just pick it. - $cgi->param('component', $product->components->[0]->name); +# If there is only one active component, choose it +my @active = grep { $_->is_active } @{$product->components}; +if (scalar(@active) == 1) { + $cgi->param('component', $active[0]->name); +} + +# If there is only one active version, choose it +@active = grep { $_->is_active } @{$product->versions}; +if (scalar(@active) == 1) { + $cgi->param('version', $active[0]->name); } my %default;