aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2016-04-05 17:22:25 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2016-04-05 17:22:25 +0200
commitaa5f64e15b5db9ef728032b21a3d85835bec0598 (patch)
tree5f1f38d7c9ef74930e260baa21dfe7a80d727dcd
parent97a24182d168363860dc153771e0b93f9520036d (diff)
downloadbugs-aa5f64e15b5db9ef728032b21a3d85835bec0598.tar
bugs-aa5f64e15b5db9ef728032b21a3d85835bec0598.tar.gz
bugs-aa5f64e15b5db9ef728032b21a3d85835bec0598.tar.bz2
bugs-aa5f64e15b5db9ef728032b21a3d85835bec0598.tar.xz
bugs-aa5f64e15b5db9ef728032b21a3d85835bec0598.zip
Bug 1261124: When deleting a component, this component is listed again
r/a=dkl
-rw-r--r--Bugzilla/Component.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm
index 9bc0a4493..d5a6ece5d 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();