summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-09-10 11:22:28 +0200
committermkanat%bugzilla.org <>2006-09-10 11:22:28 +0200
commitbb61c992c9c2ff6c9d51ac9fcde5165bf6be7e21 (patch)
treea0095414e9678dc0942d391d0727cd85568a2a36 /Bugzilla
parent1a4d88f3293090175276c9b81cfe6727483f7ae8 (diff)
downloadbugzilla-bb61c992c9c2ff6c9d51ac9fcde5165bf6be7e21.tar.gz
bugzilla-bb61c992c9c2ff6c9d51ac9fcde5165bf6be7e21.tar.xz
Bug 351339: Move group insertion out of post_bug.cgi and into Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 46b247425..0dfc91668 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -242,13 +242,23 @@ sub create {
$class->check_required_create_fields(@_);
my $params = $class->run_create_validators(@_);
- # "cc" is not a field in the bugs table, so we don't pass it to
+ # These are not a fields in the bugs table, so we don't pass them to
# insert_create_data.
my $cc_ids = $params->{cc};
delete $params->{cc};
+ my $groups = $params->{groups};
+ delete $params->{groups};
my $bug = $class->insert_create_data($params);
+ # Add the group restrictions
+ my $sth_group = $dbh->prepare(
+ 'INSERT INTO bug_group_map (bug_id, group_id) VALUES (?, ?)');
+ foreach my $group_id (@$groups) {
+ $sth_group->execute($bug->bug_id, $group_id);
+ }
+
+ # Add the CCs
my $sth_cc = $dbh->prepare('INSERT INTO cc (bug_id, who) VALUES (?,?)');
foreach my $user_id (@$cc_ids) {
$sth_cc->execute($bug->bug_id, $user_id);
@@ -274,6 +284,9 @@ sub run_create_validators {
$params->{version} = $class->_check_version($product, $params->{version});
+ $params->{groups} = $class->_check_groups($product,
+ $params->{groups});
+
my $component = $class->_check_component($product, $params->{component});
$params->{component_id} = $component->id;
delete $params->{component};