summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-09-08 13:57:23 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-09-08 13:57:23 +0200
commiteeffc2b5c38786c8626431435fab7afd5446cf74 (patch)
treee34ea48364bf3bd5f902f1c522ff942bc3ae0749 /Bugzilla
parent755783f4d0737cd936bbf635e40760241e61d4d4 (diff)
downloadbugzilla-eeffc2b5c38786c8626431435fab7afd5446cf74.tar.gz
bugzilla-eeffc2b5c38786c8626431435fab7afd5446cf74.tar.xz
Bug 271758: noresolveonopenblockers = on doesn't allow removing open blockers and resolve the bug in a single change
r/a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm37
1 files changed, 6 insertions, 31 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 2cf49d151..db9f2438d 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1757,13 +1757,14 @@ sub _check_resolution {
# Check noresolveonopenblockers.
if (Bugzilla->params->{"noresolveonopenblockers"}
&& $resolution eq 'FIXED'
- && (!$self->resolution || $resolution ne $self->resolution))
+ && (!$self->resolution || $resolution ne $self->resolution)
+ && scalar @{$self->dependson})
{
- my @dependencies = CountOpenDependencies($self->id);
- if (@dependencies) {
+ my $dep_bugs = Bugzilla::Bug->new_from_list($self->dependson);
+ my $count_open = grep { $_->isopened } @$dep_bugs;
+ if ($count_open) {
ThrowUserError("still_unresolved_bugs",
- { dependencies => \@dependencies,
- dependency_count => scalar @dependencies });
+ { bug_id => $self->id, dep_count => $count_open });
}
}
@@ -3775,32 +3776,6 @@ sub map_fields {
return \%field_values;
}
-# CountOpenDependencies counts the number of open dependent bugs for a
-# list of bugs and returns a list of bug_id's and their dependency count
-# It takes one parameter:
-# - A list of bug numbers whose dependencies are to be checked
-sub CountOpenDependencies {
- my (@bug_list) = @_;
- my @dependencies;
- my $dbh = Bugzilla->dbh;
-
- my $sth = $dbh->prepare(
- "SELECT blocked, COUNT(bug_status) " .
- "FROM bugs, dependencies " .
- "WHERE " . $dbh->sql_in('blocked', \@bug_list) .
- "AND bug_id = dependson " .
- "AND bug_status IN (" . join(', ', map {$dbh->quote($_)} BUG_STATE_OPEN) . ") " .
- $dbh->sql_group_by('blocked'));
- $sth->execute();
-
- while (my ($bug_id, $dependencies) = $sth->fetchrow_array()) {
- push(@dependencies, { bug_id => $bug_id,
- dependencies => $dependencies });
- }
-
- return @dependencies;
-}
-
################################################################################
# check_can_change_field() defines what users are allowed to change. You
# can add code here for site-specific policy changes, according to the