Commit 86a9c38e authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 376427: Exported XML files contain the incorrect status and resolution (they…

Bug 376427: Exported XML files contain the incorrect status and resolution (they are always set to RESOLVED MOVED) - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
parent 92c064fb
...@@ -59,6 +59,8 @@ use Bugzilla::Component; ...@@ -59,6 +59,8 @@ use Bugzilla::Component;
use Bugzilla::Keyword; use Bugzilla::Keyword;
use Bugzilla::Flag; use Bugzilla::Flag;
use Storable qw(dclone);
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
local our $whoid = $user->id; local our $whoid = $user->id;
my $grouplist = $user->groups_as_string; my $grouplist = $user->groups_as_string;
...@@ -474,18 +476,19 @@ if ($action eq Bugzilla->params->{'move-button-text'}) { ...@@ -474,18 +476,19 @@ if ($action eq Bugzilla->params->{'move-button-text'}) {
'cc READ', 'fielddefs READ', 'bug_status READ', 'cc READ', 'fielddefs READ', 'bug_status READ',
'status_workflow READ', 'resolution READ'); 'status_workflow READ', 'resolution READ');
my @bugs;
# First update all moved bugs. # First update all moved bugs.
foreach my $id (@idlist) { foreach my $bug (@bug_objects) {
my $bug = new Bugzilla::Bug($id); $bug->add_comment(scalar $cgi->param('comment'),
push(@bugs, $bug);
$bug->add_comment(scalar $cgi->param('comment'),
{ type => CMT_MOVED_TO, extra_data => $user->login }); { type => CMT_MOVED_TO, extra_data => $user->login });
}
# Don't export the new status and resolution. We want the current ones.
local $Storable::forgive_me = 1;
my $bugs = dclone(\@bug_objects);
foreach my $bug (@bug_objects) {
$bug->set_status('RESOLVED'); $bug->set_status('RESOLVED');
$bug->set_resolution('MOVED'); $bug->set_resolution('MOVED');
} }
$_->update() foreach @bug_objects;
$_->update() foreach @bugs;
$dbh->bz_unlock_tables(); $dbh->bz_unlock_tables();
# Now send emails. # Now send emails.
...@@ -511,7 +514,7 @@ if ($action eq Bugzilla->params->{'move-button-text'}) { ...@@ -511,7 +514,7 @@ if ($action eq Bugzilla->params->{'move-button-text'}) {
$displayfields{$_} = 1; $displayfields{$_} = 1;
} }
$template->process("bug/show.xml.tmpl", { bugs => \@bugs, $template->process("bug/show.xml.tmpl", { bugs => $bugs,
displayfields => \%displayfields, displayfields => \%displayfields,
}, \$msg) }, \$msg)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment