From 20ed8a92744b90c7b6b5eab19d0ed7e846100a5e Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Wed, 12 May 2010 23:28:30 -0700 Subject: Bug 556123: process_bug.cgi: move the setting of comments and work_time into Bugzilla::Bug::set_all r=dkl, a=mkanat --- Bugzilla/Bug.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index c0c2d97ff..b9c64da7f 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1848,6 +1848,27 @@ sub _set_global_validator { # "Set" Methods # ################# +sub set_all { + my $self = shift; + my ($params) = @_; + + if (exists $params->{'comment'} or exists $params->{'work_time'}) { + # Add a comment as needed to each bug. This is done early because + # there are lots of things that want to check if we added a comment. + $self->add_comment($params->{'comment'}->{'body'}, + { isprivate => $params->{'comment'}->{'is_private'}, + work_time => $params->{'work_time'} }); + } + + my %normal_set_all; + foreach my $name (keys %$params) { + if ($self->can("set_$name")) { + $normal_set_all{$name} = $params->{$name}; + } + } + $self->SUPER::set_all(\%normal_set_all); +} + sub set_alias { $_[0]->set('alias', $_[1]); } sub set_assigned_to { my ($self, $value) = @_; -- cgit v1.2.3-24-g4f1b