Commit aa5f64e1 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1261124: When deleting a component, this component is listed again

r/a=dkl
parent 97a24182
......@@ -148,7 +148,8 @@ sub remove_from_db {
$dbh->bz_start_transaction();
# Products must have at least one component.
if (scalar(@{$self->product->components}) == 1) {
my @components = @{ $self->product->components };
if (scalar(@components) == 1) {
ThrowUserError('component_is_last', { comp => $self });
}
......@@ -165,6 +166,8 @@ sub remove_from_db {
ThrowUserError('component_has_bugs', {nb => $self->bug_count});
}
}
# Update the list of components in the product object.
$self->product->{components} = [grep { $_->id != $self->id } @components];
$self->SUPER::remove_from_db();
$dbh->bz_commit_transaction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment