Bug 54779 - Do not crash with a code error, but warn user in the case of different product case

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1448 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-10-26 11:57:33 +00:00
parent 7017896252
commit 19e01dc112
2 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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 %]:<br />