From 43f03aa4fb7fce809332f05e6d973430a515f960 Mon Sep 17 00:00:00 2001 From: "dkl%redhat.com" <> Date: Sun, 4 Jan 2009 04:38:35 +0000 Subject: Bug 99205: Allow mass-editing of dependencies Patch by Dave Lawrence - r/a=mkanat --- Bugzilla/Bug.pm | 4 +++- process_bug.cgi | 22 +++++++++++++---- template/en/default/list/edit-multiple.html.tmpl | 30 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 6399e34a4..cfc01ba7b 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1156,7 +1156,9 @@ sub _check_dependencies { my %deps_in = (dependson => $depends_on || '', blocked => $blocks || ''); foreach my $type qw(dependson blocked) { - my @bug_ids = split(/[\s,]+/, $deps_in{$type}); + my @bug_ids = ref($deps_in{$type}) + ? @{$deps_in{$type}} + : split(/[\s,]+/, $deps_in{$type}); # Eliminate nulls. @bug_ids = grep {$_} @bug_ids; # We do this up here to make sure all aliases are converted to IDs. diff --git a/process_bug.cgi b/process_bug.cgi index bea5d1a7b..c64594bd9 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -271,10 +271,24 @@ if ($cgi->param('id') && (defined $cgi->param('dependson') $first_bug->set_dependencies(scalar $cgi->param('dependson'), scalar $cgi->param('blocked')); } -# Right now, you can't modify dependencies on a mass change. -else { - $cgi->delete('dependson'); - $cgi->delete('blocked'); +elsif (should_set('dependson') || should_set('blocked')) { + foreach my $bug (@bug_objects) { + my %temp_deps; + foreach my $type (qw(dependson blocked)) { + $temp_deps{$type} = { map { $_ => 1 } @{$bug->$type} }; + if (should_set($type) && $cgi->param($type . '_action') =~ /^(add|remove)$/) { + foreach my $id (split(/[,\s]+/, $cgi->param($type))) { + if ($cgi->param($type . '_action') eq 'remove') { + delete $temp_deps{$type}{$id}; + } + else { + $temp_deps{$type}{$id} = 1; + } + } + } + } + $bug->set_dependencies([ keys %{$temp_deps{'dependson'}} ], [ keys %{$temp_deps{'blocked'}} ]); + } } my $any_keyword_changes; diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 9fa5a1088..6a62a80dc 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -229,6 +229,36 @@ [% END %] + + + + + + + + + + + + + + + + + + + + [% IF Param('usestatuswhiteboard') %] -- cgit v1.2.3-24-g4f1b