summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-07-07 23:17:17 +0200
committerlpsolit%gmail.com <>2005-07-07 23:17:17 +0200
commit7459578f65927f1bd2b44b7a1884ee85cf174be5 (patch)
tree76318fec15f9c5e05985fd1175b6166bca229119 /process_bug.cgi
parent44119f9d89be2b5d25351637c35614ea9a180c69 (diff)
downloadbugzilla-7459578f65927f1bd2b44b7a1884ee85cf174be5.tar.gz
bugzilla-7459578f65927f1bd2b44b7a1884ee85cf174be5.tar.xz
Bug 242318: "blocked" field is ignored in post_bug.cgi if the "dependson" field isn't present - Patch by Frédéric Buclin <LpSolit@gmail.com> r=kiko a=justdave
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi72
1 files changed, 6 insertions, 66 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index c90ed42d9..f2f71710d 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -142,7 +142,7 @@ ValidateComment(scalar $cgi->param('comment'));
# is a bug alias that gets converted to its corresponding bug ID
# during validation.
foreach my $field ("dependson", "blocked") {
- if (defined $cgi->param($field) && $cgi->param($field) ne "") {
+ if ($cgi->param($field)) {
my @validvalues;
foreach my $id (split(/[\s,]+/, $cgi->param($field))) {
next unless $id;
@@ -1319,71 +1319,11 @@ foreach my $id (@idlist) {
|| ThrowTemplateError($template->error());
exit;
}
-
- my %deps;
- if (defined $cgi->param('dependson')) {
- my $me = "blocked";
- my $target = "dependson";
- my %deptree;
- for (1..2) {
- $deptree{$target} = [];
- my %seen;
- foreach my $i (split('[\s,]+', $cgi->param($target))) {
- next if $i eq "";
-
- if ($id eq $i) {
- ThrowUserError("dependency_loop_single");
- }
- if (!exists $seen{$i}) {
- push(@{$deptree{$target}}, $i);
- $seen{$i} = 1;
- }
- }
- # populate $deps{$target} as first-level deps only.
- # and find remainder of dependency tree in $deptree{$target}
- @{$deps{$target}} = @{$deptree{$target}};
- my @stack = @{$deps{$target}};
- while (@stack) {
- my $i = shift @stack;
- SendSQL("SELECT $target FROM dependencies WHERE $me = " .
- SqlQuote($i));
- while (MoreSQLData()) {
- my $t = FetchOneColumn();
- # ignore any _current_ dependencies involving this bug,
- # as they will be overwritten with data from the form.
- if ($t != $id && !exists $seen{$t}) {
- push(@{$deptree{$target}}, $t);
- push @stack, $t;
- $seen{$t} = 1;
- }
- }
- }
- if ($me eq 'dependson') {
- my @deps = @{$deptree{'dependson'}};
- my @blocks = @{$deptree{'blocked'}};
- my @union = ();
- my @isect = ();
- my %union = ();
- my %isect = ();
- foreach my $b (@deps, @blocks) { $union{$b}++ && $isect{$b}++ }
- @union = keys %union;
- @isect = keys %isect;
- if (@isect > 0) {
- my $both;
- foreach my $i (@isect) {
- $both = $both . GetBugLink($i, "#" . $i) . " ";
- }
-
- ThrowUserError("dependency_loop_multi",
- { both => $both });
- }
- }
- my $tmp = $me;
- $me = $target;
- $target = $tmp;
- }
- }
+ # Gather the dependency list, and make sure there are no circular refs
+ my %deps = Bugzilla::Bug::ValidateDependencies($cgi->param('dependson'),
+ $cgi->param('blocked'),
+ $id);
#
# Start updating the relevant database entries
@@ -1567,7 +1507,7 @@ foreach my $id (@idlist) {
undef, $id)};
@dependencychanged{@oldlist} = 1;
- if (defined $cgi->param('dependson')) {
+ if (defined $cgi->param($target)) {
my %snapshot;
my @newlist = sort {$a <=> $b} @{$deps{$target}};
@dependencychanged{@newlist} = 1;