]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 940010 - When entering a new bug, if there's only one active version or component...
authorSimon Green <sgreen@redhat.com>
Thu, 2 Jan 2014 22:11:04 +0000 (08:11 +1000)
committerSimon Green <sgreen@redhat.com>
Thu, 2 Jan 2014 22:11:04 +0000 (08:11 +1000)
r=LpSolit, a=sgreen

enter_bug.cgi

index a609a2b9a5963b51c416fa0edbf19ce391d7b380..1769b464c09dbded4f16212cd644bdf8476103aa 100755 (executable)
@@ -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;