summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-02-26 07:05:21 +0100
committerlpsolit%gmail.com <>2008-02-26 07:05:21 +0100
commita45549418844d31b8066ad365517c43c554580b9 (patch)
tree96e714490d06b05e0a98c9ccf7b0879ee0b75708
parentf0dab615aa5a5dea7b6d8c53e333b8072d781d57 (diff)
downloadbugzilla-a45549418844d31b8066ad365517c43c554580b9.tar.gz
bugzilla-a45549418844d31b8066ad365517c43c554580b9.tar.xz
Bug 419243: get_new_status_and_resolution() no longer exists and bug moving fails - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rwxr-xr-xBugzilla/Bug.pm36
-rwxr-xr-xprocess_bug.cgi15
2 files changed, 22 insertions, 29 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index a5d25885e..96f185c1f 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1349,11 +1349,6 @@ sub _check_resolution {
# Make sure this is a valid resolution.
check_field('resolution', $resolution);
- # The moving code doesn't use set_resolution. This check prevents
- # people from hacking the URL variables (or using some other interface)
- # and setting a bug to MOVED without moving it.
- ThrowCodeError('no_manual_moved') if $resolution eq 'MOVED';
-
# Don't allow open bugs to have resolutions.
ThrowUserError('resolution_not_allowed') if $self->status->is_open;
@@ -1867,12 +1862,16 @@ sub set_remaining_time { $_[0]->set('remaining_time', $_[1]); }
sub _zero_remaining_time { $_[0]->{'remaining_time'} = 0; }
sub set_reporter_accessible { $_[0]->set('reporter_accessible', $_[1]); }
sub set_resolution {
- my ($self, $value, $dupe_of) = @_;
+ my ($self, $value, $params) = @_;
my $old_res = $self->resolution;
$self->set('resolution', $value);
my $new_res = $self->resolution;
-
+
+ # MOVED has a special meaning and can only be used when
+ # really moving bugs to another installation.
+ ThrowCodeError('no_manual_moved') if ($new_res eq 'MOVED' && !$params->{moving});
+
if ($new_res ne $old_res) {
# Clear the dup_id if we're leaving the dup resolution.
if ($old_res eq 'DUPLICATE') {
@@ -1889,8 +1888,8 @@ sub set_resolution {
# of another, theoretically. Note that this code block will also run
# when going between different closed states.
if ($self->resolution eq 'DUPLICATE') {
- if ($dupe_of) {
- $self->set_dup_id($dupe_of);
+ if ($params->{dupe_of}) {
+ $self->set_dup_id($params->{dupe_of});
}
elsif (!$self->dup_id) {
ThrowUserError('dupe_id_required');
@@ -1912,7 +1911,7 @@ sub clear_resolution {
}
sub set_severity { $_[0]->set('bug_severity', $_[1]); }
sub set_status {
- my ($self, $status, $resolution, $dupe_of) = @_;
+ my ($self, $status, $params) = @_;
my $old_status = $self->status;
$self->set('bug_status', $status);
delete $self->{'status'};
@@ -1926,8 +1925,9 @@ sub set_status {
else {
# We do this here so that we can make sure closed statuses have
# resolutions.
- $self->set_resolution($resolution || $self->resolution, $dupe_of);
-
+ my $resolution = delete $params->{resolution} || $self->resolution;
+ $self->set_resolution($resolution, $params);
+
# Changing between closed statuses zeros the remaining time.
if ($new_status->id != $old_status->id && $self->remaining_time != 0) {
$self->_zero_remaining_time();
@@ -2647,14 +2647,14 @@ sub process_knob {
my $dbh = Bugzilla->dbh;
return if $action eq 'none';
-
+
+ my $dupe_move_status = Bugzilla->params->{'duplicate_or_move_bug_status'};
if ($action eq 'duplicate') {
- $self->set_status(Bugzilla->params->{'duplicate_or_move_bug_status'},
- 'DUPLICATE', $dupe_of);
+ $self->set_status($dupe_move_status,
+ {resolution => 'DUPLICATE', dupe_of => $dupe_of});
}
elsif ($action eq 'move') {
- $self->set_status(Bugzilla->params->{'duplicate_or_move_bug_status'},
- 'MOVED');
+ $self->set_status($dupe_move_status, {resolution => 'MOVED'});
}
elsif ($action eq 'change_resolution') {
$self->set_resolution($to_resolution);
@@ -2663,7 +2663,7 @@ sub process_knob {
$self->clear_resolution();
}
else {
- $self->set_status($action, $to_resolution);
+ $self->set_status($action, {resolution => $to_resolution});
}
}
diff --git a/process_bug.cgi b/process_bug.cgi
index 93b2ec1ff..277cbb0fd 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -428,22 +428,15 @@ if ($move_action eq Bugzilla->params->{'move-button-text'}) {
# First update all moved bugs.
foreach my $bug (@bug_objects) {
- $bug->add_comment(scalar $cgi->param('comment'),
- { type => CMT_MOVED_TO, extra_data => $user->login });
+ $bug->add_comment('', { 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);
+
+ my $new_status = Bugzilla->params->{'duplicate_or_move_bug_status'};
foreach my $bug (@bug_objects) {
- my ($status, $resolution) = $bug->get_new_status_and_resolution('move');
- $bug->set_status($status);
- # We don't use set_resolution here because the MOVED resolution is
- # special and is normally rejected by set_resolution.
- $bug->{resolution} = $resolution;
- # That means that we need to clear dups manually. Eventually this
- # bug-moving code will all be inside Bugzilla::Bug, so it's OK
- # to call an internal function here.
- $bug->_clear_dup_id;
+ $bug->set_status($new_status, {resolution => 'MOVED', moving => 1});
}
$_->update() foreach @bug_objects;
$dbh->bz_commit_transaction();