summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-24 21:58:53 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-24 21:58:53 +0200
commit7df590fa40af15df14183375f7fb18b7ff2e6969 (patch)
tree179655ea6059d47b3c8421ccc9093d1d8abbe852 /Bugzilla/Bug.pm
parentdd80a6716d34b2be54553245b725087ae3ee9acc (diff)
downloadbugzilla-7df590fa40af15df14183375f7fb18b7ff2e6969.tar.gz
bugzilla-7df590fa40af15df14183375f7fb18b7ff2e6969.tar.xz
Bug 556901: Move the code for setting status, resolution, and dup_id
from process_bug.cgi into Bugzilla::Bug::set_all
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm29
1 files changed, 29 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 6f0563465..f0fc46f55 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1886,6 +1886,8 @@ sub _set_global_validator {
# "Set" Methods #
#################
+# Note that if you are changing multiple bugs at once, you must pass
+# other_bugs to set_all in order for it to behave properly.
sub set_all {
my $self = shift;
my ($params) = @_;
@@ -1946,6 +1948,8 @@ sub set_all {
my %normal_set_all;
foreach my $name (keys %$params) {
+ # These are handled separately below.
+ next if grep($_ eq $name, qw(status resolution dup_id));
if ($self->can("set_$name")) {
$normal_set_all{$name} = $params->{$name};
}
@@ -1975,6 +1979,31 @@ sub set_all {
# do that here, because if they *did* change the assignee, qa, or CC,
# then we don't want to check the original ones, only the new ones.
$self->_check_strict_isolation() if $product_changed;
+
+ # You cannot mark bugs as duplicates when changing several bugs at once
+ # (because currently there is no way to check for duplicate loops in that
+ # situation).
+ if (exists $params->{'dup_id'} and $params->{other_bugs}
+ and scalar @{ $params->{other_bugs} } > 1)
+ {
+ ThrowUserError('dupe_not_allowed');
+ }
+
+ # Seting the status, resolution, and dupe_of has to be done
+ # down here, because the validity of status changes depends on
+ # other fields, such as Target Milestone.
+ if (exists $params->{'status'}) {
+ $self->set_status($params->{'status'},
+ { resolution => $params->{'resolution'},
+ dupe_of => $params->{'dup_id'} });
+ }
+ elsif (exists $params->{'resolution'}) {
+ $self->set_resolution($params->{'resolution'},
+ { dupe_of => $params->{'dup_id'} });
+ }
+ elsif (exists $params->{'dup_id'}) {
+ $self->set_dup_id($params->{'dup_id'});
+ }
}
# Helper for set_all that helps with fields that have an "add/remove"