From 737535fcbcfd91d7c15eab2f43386333af113797 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 28 Jul 2007 05:54:36 +0000 Subject: Bug 389835: Various issues when changing several bugs at once - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Bug.pm | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index de1884b7f..4793c87da 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1899,30 +1899,13 @@ sub bug_alias_to_id { # Workflow Control routines ##################################################################### -# Make sure that the new status is valid for ALL bugs. +# Make sure that the new status is allowed by the status workflow. sub check_status_transition { - my ($self, $new_status, $bug_ids) = @_; - my $dbh = Bugzilla->dbh; + my ($self, $new_status) = @_; - check_field('bug_status', $new_status); - trick_taint($new_status); - - my $illegal_statuses = - $dbh->selectcol_arrayref('SELECT DISTINCT bug_status.value - FROM bug_status - INNER JOIN bugs - ON bugs.bug_status = bug_status.value - WHERE bug_id IN (' . join (',', @$bug_ids). ') - AND bug_status.id NOT IN (SELECT old_status - FROM status_workflow - INNER JOIN bug_status b_s - ON b_s.id = status_workflow.new_status - WHERE b_s.value = ?)', - undef, $new_status); - - if (scalar(@$illegal_statuses)) { - ThrowUserError('illegal_bug_status_transition', {old => $illegal_statuses, - new => $new_status}) + if (!grep { $_->name eq $self->bug_status } @{$new_status->can_change_from}) { + ThrowUserError('illegal_bug_status_transition', {old => $self->bug_status, + new => $new_status->name}) } } -- cgit v1.2.3-24-g4f1b