diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2019-11-30 23:12:11 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-01 14:53:51 -0800 |
commit | 70780e40e5586c6882e33dd65a3dc3f31031a321 (patch) | |
tree | 51fc3608bd44e7b92d07a976ca3112fd5d87d843 /describecomponents.cgi | |
parent | Merge commit '3395d78cc8b0bd660e56f73a2689d495f2a22628' into bugstest (diff) | |
download | bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.tar.gz bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.tar.bz2 bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.zip |
Gentoo-local version of 7f3a749d7bd78a3e4aee163f562d7e95b0954b44 w/ Perl-Tidy-20180220
Reformat all code using Perl-Tidy v20180220 and .perltidyrc from
matching upstream 7f3a749d7bd78a3e4aee163f562d7e95b0954b44 commit.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'describecomponents.cgi')
-rwxr-xr-x | describecomponents.cgi | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/describecomponents.cgi b/describecomponents.cgi index f74dc75f4..19e1af4a5 100755 --- a/describecomponents.cgi +++ b/describecomponents.cgi @@ -19,10 +19,10 @@ use Bugzilla::Error; use Bugzilla::Classification; use Bugzilla::Product; -my $user = Bugzilla->login(); -my $cgi = Bugzilla->cgi; +my $user = Bugzilla->login(); +my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; -my $vars = {}; +my $vars = {}; print $cgi->header(); @@ -33,37 +33,41 @@ my $product_name = trim($cgi->param('product') || ''); my $product = new Bugzilla::Product({'name' => $product_name}); unless ($product && $user->can_access_product($product->name)) { - # Products which the user is allowed to see. - my @products = @{$user->get_accessible_products}; - if (scalar(@products) == 0) { - ThrowUserError("no_products"); - } - # If there is only one product available but the user entered - # another product name, we display a list with this single - # product only, to not confuse the user with components of a - # product they didn't request. - elsif (scalar(@products) > 1 || $product_name) { - $vars->{'classifications'} = sort_products_by_classification(\@products); - $vars->{'target'} = "describecomponents.cgi"; - # If an invalid product name is given, or the user is not - # allowed to access that product, a message is displayed - # with a list of the products the user can choose from. - if ($product_name) { - $vars->{'message'} = "product_invalid"; - # Do not use $product->name here, else you could use - # this way to determine whether the product exists or not. - $vars->{'product'} = $product_name; - } - - $template->process("global/choose-product.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + # Products which the user is allowed to see. + my @products = @{$user->get_accessible_products}; + + if (scalar(@products) == 0) { + ThrowUserError("no_products"); + } + + # If there is only one product available but the user entered + # another product name, we display a list with this single + # product only, to not confuse the user with components of a + # product they didn't request. + elsif (scalar(@products) > 1 || $product_name) { + $vars->{'classifications'} = sort_products_by_classification(\@products); + $vars->{'target'} = "describecomponents.cgi"; + + # If an invalid product name is given, or the user is not + # allowed to access that product, a message is displayed + # with a list of the products the user can choose from. + if ($product_name) { + $vars->{'message'} = "product_invalid"; + + # Do not use $product->name here, else you could use + # this way to determine whether the product exists or not. + $vars->{'product'} = $product_name; } - # If there is only one product available and the user didn't specify - # any product name, we show this product. - $product = $products[0]; + $template->process("global/choose-product.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; + } + + # If there is only one product available and the user didn't specify + # any product name, we show this product. + $product = $products[0]; } ###################################################################### |