summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2004-03-18 14:55:41 +0100
committerjustdave%syndicomm.com <>2004-03-18 14:55:41 +0100
commit39a329b9ac46424a4552e8c68e44467173a8238c (patch)
tree57da556be3e1e1e7106e314738b4a9cf1e378703
parent3d59b2bd807ec35c511fd76df11b2cbb61289242 (diff)
downloadbugzilla-39a329b9ac46424a4552e8c68e44467173a8238c.tar.gz
bugzilla-39a329b9ac46424a4552e8c68e44467173a8238c.tar.xz
Bug 24496: Adds a parameter "noresolveonopenblockers" which when enabled, prevents bugs from being closed if there are any bugs blocking it which are still open.
Patch by Andreas Höfler <andreas.hoefler@bearingpoint.com> r= justdave, a= myk
-rw-r--r--defparams.pl9
-rw-r--r--globals.pl32
-rwxr-xr-xprocess_bug.cgi11
-rw-r--r--template/en/default/global/user-error.html.tmpl26
4 files changed, 77 insertions, 1 deletions
diff --git a/defparams.pl b/defparams.pl
index 1d492de20..d25f11910 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -1169,7 +1169,14 @@ Reason: %reason%
type => 't',
default => '',
},
-);
+ {
+ name => 'noresolveonopenblockers',
+ desc => 'Don\'t allow bugs to be resolved as fixed if they have unresolved dependencies.',
+ type => 'b',
+ default => 0,
+ },
+
+);
1;
diff --git a/globals.pl b/globals.pl
index 399482caa..019d6d972 100644
--- a/globals.pl
+++ b/globals.pl
@@ -1069,6 +1069,38 @@ sub GetBugLink {
}
}
+# 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;
+
+ # Make sure any unfetched data from a currently running query
+ # is saved off rather than overwritten
+ PushGlobalSQLState();
+
+ SendSQL("SELECT blocked, count(bug_status) " .
+ "FROM bugs, dependencies " .
+ "WHERE blocked IN (" . (join "," , @bug_list) . ") " .
+ "AND bug_id = dependson " .
+ "AND bug_status IN ('" . (join "','", OpenStates()) . "') " .
+ "GROUP BY blocked ");
+
+ while (MoreSQLData()) {
+ my ($bug_id, $dependencies) = FetchSQLData();
+ push(@dependencies, { bug_id => $bug_id,
+ dependencies => $dependencies });
+ }
+
+ # All done with this sidetrip
+ PopGlobalSQLState();
+
+ return @dependencies;
+}
+
sub GetLongDescriptionAsText {
my ($id, $start, $end) = (@_);
my $result = "";
diff --git a/process_bug.cgi b/process_bug.cgi
index 774883a9c..4df90efd2 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -890,6 +890,17 @@ SWITCH: for ($::FORM{'knob'}) {
ThrowUserError("resolving_remaining_time");
}
}
+
+ # don't resolve as fixed while still unresolved blocking bugs
+ if (Param("noresolveonopenblockers") && ($::FORM{'resolution'} eq 'FIXED')) {
+ my @dependencies = CountOpenDependencies(@idlist);
+ if (scalar @dependencies > 0) {
+ ThrowUserError("still_unresolved_bugs",
+ { dependencies => \@dependencies,
+ dependency_count => scalar @dependencies });
+ }
+ }
+
# Check here, because its the only place we require the resolution
CheckFormField(\%::FORM, 'resolution', \@::settable_resolution);
ChangeStatus('RESOLVED');
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 1577619ee..3bbca0cec 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -666,6 +666,32 @@
Sorry - sidebar.cgi currently only supports Mozilla based web browsers.
<a href="http://www.mozilla.org">Upgrade today</a>. :-)
+ [% ELSIF error == "still_unresolved_bugs" %]
+ [% IF dependency_count == 1 %]
+ [% terms.Bug %]# <a href="show_bug.cgi?id=[% dependencies.0.bug_id %]">[% dependencies.0.bug_id %]</a>
+ has still [% dependencies.0.dependencies FILTER html %] unresolved
+ [% IF dependencies.0.dependencies == 1 %]
+ dependency
+ [% ELSE %]
+ dependencies
+ [% END %]. Show
+ <a href="showdependencytree.cgi?id=[% dependencies.0.bug_id %]">Dependency Tree</a>.
+ [% ELSE %]
+ There are [% dependency_count %] open [% terms.bugs %] which
+ have unresolved dependencies.
+ <br>
+ [% FOREACH bug = dependencies %]
+ [% terms.Bug %]# <a href="show_bug.cgi?id=[% bug.bug_id %]">[% bug.bug_id %]</a>
+ has [% bug.dependencies FILTER html %] open
+ [% IF bug.dependencies == 1 %]
+ dependency.
+ [% ELSE %]
+ dependencies.
+ [% END %]
+ (<a href="showdependencytree.cgi?id=[% bug.bug_id %]">Dependency Tree</a>)<br>
+ [% END %]
+ [% END %]
+
[% ELSIF error == "too_many_votes_for_bug" %]
[% title = "Illegal Vote" %]
You may only use at most [% max FILTER html %] votes for a single