summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-01 10:32:12 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-01 10:32:12 +0200
commitbc82259f9284e3d682536086637ace46cd8ab6ea (patch)
tree36b90f2d3b7423a1826bafac596be031a000b887 /Bugzilla
parent2a32a01cd5973a2cd0c03e79405ae75ecb3f48d4 (diff)
downloadbugzilla-bc82259f9284e3d682536086637ace46cd8ab6ea.tar.gz
bugzilla-bc82259f9284e3d682536086637ace46cd8ab6ea.tar.xz
Bug 674574: When all components or versions are disabled, you cannot enter bugs into the product but it's listed in enter_bug.cgi anyway
r=dkl a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User.pm23
1 files changed, 14 insertions, 9 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 188432241..3a3edcb5b 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1004,11 +1004,15 @@ sub can_enter_product {
ThrowUserError('product_disabled', { product => $product });
}
# It could have no components...
- elsif (!@{$product->components}) {
+ elsif (!@{$product->components}
+ || !grep { $_->is_active } @{$product->components})
+ {
ThrowUserError('missing_component', { product => $product });
}
# It could have no versions...
- elsif (!@{$product->versions}) {
+ elsif (!@{$product->versions}
+ || !grep { $_->is_active } @{$product->versions})
+ {
ThrowUserError ('missing_version', { product => $product });
}
@@ -1024,28 +1028,29 @@ sub get_enterable_products {
}
# All products which the user has "Entry" access to.
- my @enterable_ids =@{$dbh->selectcol_arrayref(
+ my $enterable_ids = $dbh->selectcol_arrayref(
'SELECT products.id FROM products
LEFT JOIN group_control_map
ON group_control_map.product_id = products.id
AND group_control_map.entry != 0
AND group_id NOT IN (' . $self->groups_as_string . ')
WHERE group_id IS NULL
- AND products.isactive = 1') || []};
+ AND products.isactive = 1');
- if (@enterable_ids) {
+ if (scalar @$enterable_ids) {
# And all of these products must have at least one component
# and one version.
- @enterable_ids = @{$dbh->selectcol_arrayref(
+ $enterable_ids = $dbh->selectcol_arrayref(
'SELECT DISTINCT products.id FROM products
INNER JOIN components ON components.product_id = products.id
INNER JOIN versions ON versions.product_id = products.id
- WHERE products.id IN (' . (join(',', @enterable_ids)) .
- ')') || []};
+ WHERE products.id IN (' . join(',', @$enterable_ids) . ')
+ AND components.isactive = 1
+ AND versions.isactive = 1');
}
$self->{enterable_products} =
- Bugzilla::Product->new_from_list(\@enterable_ids);
+ Bugzilla::Product->new_from_list($enterable_ids);
return $self->{enterable_products};
}