summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-17 00:25:53 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-17 00:25:53 +0200
commit2cdcaa08031424c393878bed91f81fc92e4328a4 (patch)
treee1605a493d08ee4e4fc965207343ef9d681ef1b8 /Bugzilla/Bug.pm
parent003e49ae68c247448a5d9d18cb0110432668fdfd (diff)
downloadbugzilla-2cdcaa08031424c393878bed91f81fc92e4328a4.tar.gz
bugzilla-2cdcaa08031424c393878bed91f81fc92e4328a4.tar.xz
Bug 556167: Move the setting of dependson/blocked from process_bug.cgi
into Bugzilla::Bug::set_all r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index ee53a0aae..26e71c4f8 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1854,6 +1854,36 @@ sub set_all {
my $self = shift;
my ($params) = @_;
+ if (exists $params->{'dependson'} or exists $params->{'blocked'}) {
+ my %set_deps;
+ foreach my $name (qw(dependson blocked)) {
+ my @dep_ids = @{ $self->$name };
+ # If only one of the two fields was passed in, then we need to
+ # retain the current value for the other one.
+ if (!exists $params->{$name}) {
+ $set_deps{$name} = \@dep_ids;
+ next;
+ }
+
+ # Explicitly setting them to a particular value overrides
+ # add/remove.
+ if (exists $params->{$name}->{set}) {
+ $set_deps{$name} = $params->{$name}->{set};
+ next;
+ }
+
+ foreach my $add (@{ $params->{$name}->{add} || [] }) {
+ push(@dep_ids, $add) if !grep($_ == $add, @dep_ids);
+ }
+ foreach my $remove (@{ $params->{$name}->{remove} || [] }) {
+ @dep_ids = grep($_ != $remove, @dep_ids);
+ }
+ $set_deps{$name} = \@dep_ids;
+ }
+
+ $self->set_dependencies($set_deps{'dependson'}, $set_deps{'blocked'});
+ }
+
if (exists $params->{'keywords'}) {
$self->modify_keywords($params->{'keywords'},
$params->{'keywords_action'});