summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-23 23:07:13 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-23 23:07:13 +0200
commitfeef94f798c07a1d8fde3ed8a06e04b6e68f393b (patch)
tree8c6c5a7786032bf076864f10412bca6bf91cacf6
parenteac46d8ce4bb473fa40653dbccd0849bdecd01e2 (diff)
downloadbugzilla-feef94f798c07a1d8fde3ed8a06e04b6e68f393b.tar.gz
bugzilla-feef94f798c07a1d8fde3ed8a06e04b6e68f393b.tar.xz
Bug 573172: Prepare set_all for being used in a context other than
process_bug.cgi r=dkl, a=mkanat
-rw-r--r--Bugzilla/Bug.pm25
-rw-r--r--template/en/default/global/user-error.html.tmpl4
2 files changed, 20 insertions, 9 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 187b6a1dc..614d83a64 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2073,6 +2073,15 @@ sub set_all {
my $self = shift;
my ($params) = @_;
+ # You cannot mark bugs as duplicate when changing several bugs at once
+ # (because currently there is no way to check for duplicate loops in that
+ # situation). You also cannot set the alias of several bugs at once.
+ if ($params->{other_bugs} and scalar @{ $params->{other_bugs} } > 1) {
+ ThrowUserError('dupe_not_allowed') if exists $params->{dup_id};
+ ThrowUserError('multiple_alias_not_allowed')
+ if defined $params->{alias};
+ }
+
# For security purposes, and because lots of other checks depend on it,
# we set the product first before anything else.
my $product_changed; # Used only for strict_isolation checks.
@@ -2162,15 +2171,6 @@ 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');
- }
}
# Helper for set_all that helps with fields that have an "add/remove"
@@ -2606,6 +2606,13 @@ sub add_comment {
return;
}
+ # If the user has explicitly set remaining_time, this will be overridden
+ # later in set_all. But if they haven't, this keeps remaining_time
+ # up-to-date.
+ if ($params->{work_time}) {
+ $self->set_remaining_time($self->remaining_time - $params->{work_time});
+ }
+
# So we really want to comment. Make sure we are allowed to do so.
my $privs;
$self->check_can_change_field('longdesc', 0, 1, \$privs)
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 0d053cb74..373a9dc31 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1182,6 +1182,10 @@
to add a version to this product.
[% END %]
+ [% ELSIF error == "multiple_alias_not_allowed" %]
+ You cannot set aliases when modifying multiple [% terms.bugs %]
+ at once.
+
[% ELSIF error == "need_quip" %]
[% title = "Quip Required" %]
[% docslinks = {'quips.html' => 'About quips'} %]