diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2016-04-05 17:21:22 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2016-04-05 17:21:22 +0200 |
commit | 6c14face26954e4e2b537ba5342c71ae37a6b9b8 (patch) | |
tree | c363b235abe7f5d48d17e8517dcfa47a3b801879 /Bugzilla | |
parent | 6be9f0a286b2e9abf0119173a9e66c37a7d9f0a1 (diff) | |
download | bugzilla-6c14face26954e4e2b537ba5342c71ae37a6b9b8.tar.gz bugzilla-6c14face26954e4e2b537ba5342c71ae37a6b9b8.tar.xz |
Bug 1261124: When deleting a component, this component is listed again
r=dkl
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Component.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 22c424599..77d07e4c2 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -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(); |