diff options
author | mkanat%bugzilla.org <> | 2007-03-10 21:46:06 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-03-10 21:46:06 +0100 |
commit | 8705d693875ea5f56c6d2e84d23462013faaf414 (patch) | |
tree | f8635829555be5da7574b96e1bb54bc0ce71ccee /process_bug.cgi | |
parent | 839d66da3f158712fe59bf5fd480df12512f4bf6 (diff) | |
download | bugzilla-8705d693875ea5f56c6d2e84d23462013faaf414.tar.gz bugzilla-8705d693875ea5f56c6d2e84d23462013faaf414.tar.xz |
Bug 372700: Make Bugzilla::Bug do bug updating for moving in process_bug.cgi
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-x | process_bug.cgi | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/process_bug.cgi b/process_bug.cgi index 18097d084..a8603dc44 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -554,52 +554,26 @@ if ($action eq Bugzilla->params->{'move-button-text'}) { $user->is_mover || ThrowUserError("auth_failure", {action => 'move', object => 'bugs'}); - # Moved bugs are marked as RESOLVED MOVED. - my $sth = $dbh->prepare("UPDATE bugs - SET bug_status = 'RESOLVED', - resolution = 'MOVED', - delta_ts = ? - WHERE bug_id = ?"); - # Bugs cannot be a dupe and moved at the same time. - my $sth2 = $dbh->prepare("DELETE FROM duplicates WHERE dupe = ?"); - - my $comment = ""; - if (defined $cgi->param('comment') && $cgi->param('comment') !~ /^\s*$/) { - $comment = $cgi->param('comment'); - } - $dbh->bz_lock_tables('bugs WRITE', 'bugs_activity WRITE', 'duplicates WRITE', 'longdescs WRITE', 'profiles READ', 'groups READ', 'bug_group_map READ', 'group_group_map READ', 'user_group_map READ', 'classifications READ', 'products READ', 'components READ', 'votes READ', - 'cc READ', 'fielddefs READ'); + 'cc READ', 'fielddefs READ', 'bug_status READ', + 'resolution READ'); - my $timestamp = $dbh->selectrow_array("SELECT NOW()"); my @bugs; # First update all moved bugs. foreach my $id (@idlist) { my $bug = new Bugzilla::Bug($id); push(@bugs, $bug); - $bug->add_comment($comment, { type => CMT_MOVED_TO, - extra_data => $user->login }); + $bug->add_comment(scalar $cgi->param('comment'), + { type => CMT_MOVED_TO, extra_data => $user->login }); + $bug->set_status('RESOLVED'); + $bug->set_resolution('MOVED'); } - foreach my $bug (@bugs) { - $bug->update($timestamp); - my $id = $bug->bug_id; - - $sth->execute($timestamp, $id); - $sth2->execute($id); - if ($bug->bug_status ne 'RESOLVED') { - LogActivityEntry($id, 'bug_status', $bug->bug_status, - 'RESOLVED', $whoid, $timestamp); - } - if ($bug->resolution ne 'MOVED') { - LogActivityEntry($id, 'resolution', $bug->resolution, - 'MOVED', $whoid, $timestamp); - } - } + $_->update() foreach @bugs; $dbh->bz_unlock_tables(); # Now send emails. |