diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 62bfa63d6..95f1ab9cf 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -862,6 +862,10 @@ sub can_enter_product { elsif (!@{$product->versions}) { ThrowUserError ('missing_version', { product => $product }); } + # It could have the name in a different case :) + elsif (!blessed($input) && $product->name ne $input) { + ThrowUserError ('product_invalid_case', { product => $input, suggested => $product->name }); + } die "can_enter_product reached an unreachable location."; } @@ -874,15 +878,15 @@ sub get_enterable_products { return $self->{enterable_products}; } - # All products which the user has "Entry" access to. - 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') || []}; + # All products which the user has "Entry" access to. + 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') || []}; if (@enterable_ids) { # And all of these products must have at least one component diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index b2eaf201e..bb4c3eeef 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1716,6 +1716,10 @@ I could not figure out what you wanted to do. [% END %] + [% ELSIF error == "product_invalid_case" %] + You have requested the product name "[% product | html %]", did you mean + "[% suggested | html %]"? + [% ELSIF error == "incorrect_field_values" %] [% IF bug_id %] [% terms.Bug %] [%+ bug_id %]: