summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-05-15 02:57:35 +0200
committermkanat%bugzilla.org <>2007-05-15 02:57:35 +0200
commitf65619b0235e24eb5df01fe82c90a45b2ae985e6 (patch)
treeccc8a187ac6fd1026439c435b580fa2cf83fb420 /process_bug.cgi
parent399108ea7381ed961c33bbfdafec78824fe737da (diff)
downloadbugzilla-f65619b0235e24eb5df01fe82c90a45b2ae985e6.tar.gz
bugzilla-f65619b0235e24eb5df01fe82c90a45b2ae985e6.tar.xz
Bug 373660: Move dependency checking from process_bug into Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi46
1 files changed, 10 insertions, 36 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 8be6cb48f..a28efa02f 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -185,42 +185,16 @@ $cgi->param('comment', $bug->_check_comment($cgi->param('comment')));
# instead of throwing an error, f.e. when one or more of the values
# is a bug alias that gets converted to its corresponding bug ID
# during validation.
-foreach my $field ("dependson", "blocked") {
- if ($cgi->param('id')) {
- my @old = @{$bug->$field};
- my @new;
- foreach my $id (split(/[\s,]+/, $cgi->param($field))) {
- next unless $id;
- ValidateBugID($id, $field);
- push @new, $id;
- }
- $cgi->param($field, join(",", @new));
- my ($added, $removed) = Bugzilla::Util::diff_arrays(\@old, \@new);
- foreach my $id (@$added , @$removed) {
- # ValidateBugID is called without $field here so that it will
- # throw an error if any of the changed bugs are not visible.
- ValidateBugID($id);
- if (Bugzilla->params->{"strict_isolation"}) {
- my $deltabug = new Bugzilla::Bug($id);
- if (!$user->can_edit_product($deltabug->{'product_id'})) {
- $vars->{'field'} = $field;
- ThrowUserError("illegal_change_deps", $vars);
- }
- }
- }
- if ((@$added || @$removed)
- && !$bug->check_can_change_field($field, 0, 1, \$PrivilegesRequired))
- {
- $vars->{'privs'} = $PrivilegesRequired;
- $vars->{'field'} = $field;
- ThrowUserError("illegal_change", $vars);
- }
- } else {
- # Bugzilla does not support mass-change of dependencies so they
- # are not validated. To prevent a URL-hacking risk, the dependencies
- # are deleted for mass-changes.
- $cgi->delete($field);
- }
+if ($cgi->param('id')) {
+ my ($dependson, $blocks) = $bug->_check_dependencies(
+ scalar $cgi->param('dependson'), scalar $cgi->param('blocked'));
+ $cgi->param('dependson', $dependson);
+ $cgi->param('blocked', $blocks);
+}
+# Right now, you can't modify dependencies on a mass change.
+else {
+ $cgi->delete('dependson');
+ $cgi->delete('blocked');
}
# do a match on the fields if applicable