]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 99205: Allow mass-editing of dependencies
authordkl%redhat.com <>
Sun, 4 Jan 2009 04:38:35 +0000 (04:38 +0000)
committerdkl%redhat.com <>
Sun, 4 Jan 2009 04:38:35 +0000 (04:38 +0000)
Patch by Dave Lawrence <dkl@redhat.com> - r/a=mkanat

Bugzilla/Bug.pm
process_bug.cgi
template/en/default/list/edit-multiple.html.tmpl

index 6399e34a43002f5edee61d4c9edeaeab3c0b415f..cfc01ba7b6022f138c52a7a823a42a1173a707ff 100644 (file)
@@ -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.
index bea5d1a7b0442ecd9d46bb56ccdca551f51f541b..c64594bd94dc21fcc06d6546e1cf022a0c5f68d6 100755 (executable)
@@ -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;
index 9fa5a1088e9c1d678deb28b26410f347d6068c5d..6a62a80dccc8526ab033992a0f6f2fd22f3b541e 100644 (file)
     </tr>
   [% END %]
 
+  <tr>
+    <th>
+      <label for="dependson">
+          Depends On:
+      </label>
+    </th>
+    <td colspan="3">
+      <input id="dependson" name="dependson" size="32">
+      <select name="dependson_action">
+          <option value="add">Add these IDs</option>
+          <option value="remove">Delete these IDs</option>
+      </select>
+    </td>
+  </tr>
+
+  <tr>
+    <th>
+      <label for="blocked">
+          Blocks:
+      </label>
+    </th>
+    <td colspan="3">
+      <input id="blocked" name="blocked" size="32">
+      <select name="blocked_action">
+          <option value="add">Add these IDs</option>
+          <option value="remove">Delete these IDs</option>
+      </select>
+    </td>
+  </tr>
+
   [% IF Param('usestatuswhiteboard') %]
     <tr>
       <td align="right">