diff options
author | bugreport%peshkin.net <> | 2005-10-10 10:17:12 +0000 |
---|---|---|
committer | bugreport%peshkin.net <> | 2005-10-10 10:17:12 +0000 |
commit | 5f81c1d6a054cb593c48dd38ecc49df9a3c8688b (patch) | |
tree | 676b830a9d78b315a2a044b6413114963594bd02 | |
parent | b26634d776066be7e6e358bfff0bad4a25a27d51 (diff) | |
download | bugs-5f81c1d6a054cb593c48dd38ecc49df9a3c8688b.tar bugs-5f81c1d6a054cb593c48dd38ecc49df9a3c8688b.tar.gz bugs-5f81c1d6a054cb593c48dd38ecc49df9a3c8688b.tar.bz2 bugs-5f81c1d6a054cb593c48dd38ecc49df9a3c8688b.tar.xz bugs-5f81c1d6a054cb593c48dd38ecc49df9a3c8688b.zip |
Bug 311489 Bug entry makes user choose classification even if only one is enterable
Patch bu Joel Peshkin <bugreport@peshkin.net>
r=kiko, a=justdave
-rwxr-xr-x | enter_bug.cgi | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi index 66e182423..7c248ac72 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -74,32 +74,46 @@ if (!defined $product || $product eq "") { GetVersionTable(); Bugzilla->login(); - if ( ! Param('useclassification') ) { - # just pick the default one - $cgi->param(-name => 'classification', -value => (keys %::classdesc)[0]); - } - - if (!$cgi->param('classification')) { - my $classifications = Bugzilla->user->get_selectable_classifications(); - - if (scalar(@$classifications) == 0) { - ThrowUserError("no_products"); - } - elsif (scalar(@$classifications) > 1) { - $vars->{'classifications'} = $classifications; - - $vars->{'target'} = "enter_bug.cgi"; - $vars->{'format'} = $cgi->param('format'); + if ( ! Param('useclassification') ) { + # just pick the default one + $cgi->param(-name => 'classification', + -value => (keys %::classdesc)[0]); + } + + if (!$cgi->param('classification')) { + my $classifications = Bugzilla->user->get_selectable_classifications(); + foreach my $classification (@$classifications) { + my $found = 0; + foreach my $p (@enterable_products) { + if (CanEnterProduct($p) + && IsInClassification($classification->{name},$p)) { + $found = 1; + } + } + if ($found == 0) { + @$classifications = grep($_->{name} ne $classification->{name}, + @$classifications); + } + } + + if (scalar(@$classifications) == 0) { + ThrowUserError("no_products"); + } + elsif (scalar(@$classifications) > 1) { + $vars->{'classifications'} = $classifications; + + $vars->{'target'} = "enter_bug.cgi"; + $vars->{'format'} = $cgi->param('format'); - $vars->{'cloned_bug_id'} = $cgi->param('cloned_bug_id'); - - print $cgi->header(); - $template->process("global/choose-classification.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; - } - $cgi->param(-name => 'classification', -value => @$classifications[0]->name); - } + $vars->{'cloned_bug_id'} = $cgi->param('cloned_bug_id'); + + print $cgi->header(); + $template->process("global/choose-classification.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; + } + $cgi->param(-name => 'classification', -value => @$classifications[0]->name); + } my %products; foreach my $p (@enterable_products) { |