From 0f520772563d9b1a599b7602f01ce88c365a9951 Mon Sep 17 00:00:00 2001 From: "jake%acutex.net" <> Date: Fri, 8 Jun 2001 20:12:13 +0000 Subject: Give a logical error message if no products are available to a user for bug entry (bug 84285). Patch by Paul Thomas r= jake@acutex.net --- enter_bug.cgi | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'enter_bug.cgi') diff --git a/enter_bug.cgi b/enter_bug.cgi index 493dcadd3..2df9ca247 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -79,13 +79,13 @@ if (!defined $::FORM{'product'}) { } push(@prodlist, $p); } + if (1 != @prodlist) { print "Content-type: text/html\n\n"; - PutHeader("Enter Bug"); - - print "

First, you must pick a product on which to enter\n"; - print "a bug.

\n"; - print ""; + + my $bProdFlag = 0; + my $tableContents = ""; + foreach my $p (@prodlist) { if (defined $::proddesc{$p} && $::proddesc{$p} eq '0') { # Special hack. If we stuffed a "0" into proddesc, that means @@ -93,6 +93,7 @@ if (!defined $::FORM{'product'}) { # to allow people to specify that product here. next; } + if(Param("usebuggroupsentry") && GroupExists($p) && !UserInGroup($p)) { @@ -101,16 +102,34 @@ if (!defined $::FORM{'product'}) { # group, we don't want to include that product in this list. next; } - print "\n"; + + $bProdFlag = 1; + $tableContents .= "\n"; + if (defined $::proddesc{$p}) { - print "\n"; + $tableContents .= "\n"; } - print ""; + + $tableContents .= ""; } - print "
$p:
$p:$::proddesc{$p}$::proddesc{$p}
\n"; + + # display sensible message if no products were found for the user to enter bugs against + if ($bProdFlag) { + PutHeader("Enter Bug"); + print "

First, you must pick a product on which to enter a bug.

\n"; + print "\n"; + print $tableContents; + print "
\n"; + } else { + PutHeader("Permission Denied"); + print "Sorry. There are no products for which you may enter bugs\n"; + print "

\n"; + } + PutFooter(); exit; } + $::FORM{'product'} = $prodlist[0]; } -- cgit v1.2.3-24-g4f1b