From f7f22da2e77db2b04e060ab32b615d2d64f270c6 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 30 Oct 2008 05:23:01 +0000 Subject: [PATCH] =?utf8?q?Bug=20461127:=20Cannot=20change=20status=20and?= =?utf8?q?=20reassign=20at=20the=20same=20time=20if=20the=20assignee/QA=20?= =?utf8?q?contact=20doesn't=20have=20editbugs=20privs=20-=20Patch=20by=20F?= =?utf8?q?r=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r?= =?utf8?q?/a=3Dmkanat?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Bug.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 6961a1c5b8..dedff7175d 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -709,6 +709,10 @@ sub update { $self->_sync_fulltext() if $self->{added_comments} || $changes->{short_desc}; + # Remove obsolete internal variables. + delete $self->{'_old_assigned_to'}; + delete $self->{'_old_qa_contact'}; + return $changes; } @@ -1661,6 +1665,8 @@ sub set_alias { $_[0]->set('alias', $_[1]); } sub set_assigned_to { my ($self, $value) = @_; $self->set('assigned_to', $value); + # Store the old assignee. check_can_change_field() needs it. + $self->{'_old_assigned_to'} = $self->{'assigned_to_obj'}->id; delete $self->{'assigned_to_obj'}; } sub reset_assigned_to { @@ -1902,6 +1908,10 @@ sub set_product { sub set_qa_contact { my ($self, $value) = @_; $self->set('qa_contact', $value); + # Store the old QA contact. check_can_change_field() needs it. + if ($self->{'qa_contact_obj'}) { + $self->{'_old_qa_contact'} = $self->{'qa_contact_obj'}->id; + } delete $self->{'qa_contact_obj'}; } sub reset_qa_contact { @@ -3257,14 +3267,16 @@ sub check_can_change_field { # Make sure that a valid bug ID has been given. if (!$self->{'error'}) { # Allow the assignee to change anything else. - if ($self->{'assigned_to'} == $user->id) { + if ($self->{'assigned_to'} == $user->id + || $self->{'_old_assigned_to'} && $self->{'_old_assigned_to'} == $user->id) + { return 1; } # Allow the QA contact to change anything else. if (Bugzilla->params->{'useqacontact'} - && $self->{'qa_contact'} - && ($self->{'qa_contact'} == $user->id)) + && (($self->{'qa_contact'} && $self->{'qa_contact'} == $user->id) + || ($self->{'_old_qa_contact'} && $self->{'_old_qa_contact'} == $user->id))) { return 1; } -- 2.47.2