summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-09-12 07:16:41 +0200
committermkanat%bugzilla.org <>2006-09-12 07:16:41 +0200
commit3332dda22a14eda33c293d2fd1f2eeb73a66dc34 (patch)
treee3ceb8640bfac72a5020b26d381c532fd26e0ad8 /Bugzilla
parent901ce06e6c9218b93b84fee09f9720204623dc19 (diff)
downloadbugzilla-3332dda22a14eda33c293d2fd1f2eeb73a66dc34.tar.gz
bugzilla-3332dda22a14eda33c293d2fd1f2eeb73a66dc34.tar.xz
Bug 351877: Move dependson/blocked insertion into Bugzilla::Bug from post_bug.cgi
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 4f1939423..d49fcfd20 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -249,12 +249,21 @@ sub create {
delete $params->{cc};
my $groups = $params->{groups};
delete $params->{groups};
+ my $depends_on = $params->{dependson};
+ delete $params->{dependson};
+ my $blocked = $params->{blocked};
+ delete $params->{blocked};
# Set up the keyword cache for bug creation.
my $keywords = $params->{keywords};
$params->{keywords} = join(', ', sort {lc($a) cmp lc($b)}
map($_->name, @$keywords));
+ # We don't want the bug to appear in the system until it's correctly
+ # protected by groups.
+ my $timestamp = $params->{creation_ts};
+ delete $params->{creation_ts};
+
my $bug = $class->insert_create_data($params);
# Add the group restrictions
@@ -264,6 +273,9 @@ sub create {
$sth_group->execute($bug->bug_id, $group_id);
}
+ $dbh->do('UPDATE bugs SET creation_ts = ? WHERE bug_id = ?', undef,
+ $timestamp, $bug->bug_id);
+
# Add the CCs
my $sth_cc = $dbh->prepare('INSERT INTO cc (bug_id, who) VALUES (?,?)');
foreach my $user_id (@$cc_ids) {
@@ -277,6 +289,22 @@ sub create {
$sth_keyword->execute($bug->bug_id, $keyword_id);
}
+ # Set up dependencies (blocked/dependson)
+ my $sth_deps = $dbh->prepare(
+ 'INSERT INTO dependencies (blocked, dependson) VALUES (?, ?)');
+ foreach my $depends_on_id (@$depends_on) {
+ $sth_deps->execute($bug->bug_id, $depends_on_id);
+ # Log the reverse action on the other bug.
+ LogActivityEntry($depends_on_id, 'blocked', '', $bug->bug_id,
+ $bug->reporter->id, $timestamp);
+ }
+ foreach my $blocked_id (@$blocked) {
+ $sth_deps->execute($blocked_id, $bug->bug_id);
+ # Log the reverse action on the other bug.
+ LogActivityEntry($blocked_id, 'dependson', '', $bug->bug_id,
+ $bug->reporter->id, $timestamp);
+ }
+
return $bug;
}
@@ -317,6 +345,9 @@ sub run_create_validators {
$class->_check_strict_isolation($product, $params->{cc},
$params->{assigned_to}, $params->{qa_contact});
+ ($params->{dependson}, $params->{blocked}) =
+ $class->_check_dependencies($params->{dependson}, $params->{blocked});
+
return $params;
}