summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2002-09-23 02:14:48 +0200
committerbugreport%peshkin.net <>2002-09-23 02:14:48 +0200
commit65d3dc0ec33fd76229dc02536a74ccac5408876b (patch)
treebcacbb27e99c73f9548e92408fadb2e369f0543b /post_bug.cgi
parentcf9b4ba2e757925eeb18bb63411ae30c8600c643 (diff)
downloadbugzilla-65d3dc0ec33fd76229dc02536a74ccac5408876b.tar.gz
bugzilla-65d3dc0ec33fd76229dc02536a74ccac5408876b.tar.xz
bug 157756 - Groups_20020716_Branch Tracking : > 55 groups now supported
r=bbaetz, gerv
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi28
1 files changed, 19 insertions, 9 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 430ae37a8..22aa0e6bd 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -34,7 +34,6 @@ require "bug_form.pl";
sub sillyness {
my $zz;
$zz = $::buffer;
- $zz = $::usergroupset;
$zz = %::COOKIE;
$zz = %::components;
$zz = %::versions;
@@ -242,7 +241,7 @@ if ($::FORM{'keywords'} && UserInGroup("editbugs")) {
# Build up SQL string to add bug.
my $sql = "INSERT INTO bugs " .
- "(" . join(",", @used_fields) . ", reporter, creation_ts, groupset) " .
+ "(" . join(",", @used_fields) . ", reporter, creation_ts) " .
"VALUES (";
foreach my $field (@used_fields) {
@@ -255,14 +254,15 @@ $comment = trim($comment);
# OK except for the fact that it causes e-mail to be suppressed.
$comment = $comment ? $comment : " ";
-$sql .= "$::userid, now(), (0";
+$sql .= "$::userid, now() )";
# Groups
+my @groupstoadd = ();
foreach my $b (grep(/^bit-\d*$/, keys %::FORM)) {
if ($::FORM{$b}) {
my $v = substr($b, 4);
$v =~ /^(\d+)$/
- || ThrowCodeError("group_bit_invalid", "abort");
+ || ThrowCodeError("group_id_invalid", "abort");
if (!GroupIsActive($v)) {
# Prevent the user from adding the bug to an inactive group.
# Should only happen if there is a bug in Bugzilla or the user
@@ -271,18 +271,22 @@ foreach my $b (grep(/^bit-\d*$/, keys %::FORM)) {
$vars->{'bit'} = $v;
ThrowCodeError("inactive_group", "abort");
}
- $sql .= " + $v"; # Carefully written so that the math is
- # done by MySQL, which can handle 64-bit math,
- # and not by Perl, which I *think* can not.
+ SendSQL("SELECT user_id FROM user_group_map
+ WHERE user_id = $::userid
+ AND group_id = $v
+ AND isbless = 0");
+ my ($member) = FetchSQLData();
+ if ($member) {
+ push(@groupstoadd, $v)
+ }
}
}
-$sql .= ") & $::usergroupset)\n";
# Lock tables before inserting records for the new bug into the database
# if we are using a shadow database to prevent shadow database corruption
# when two bugs get created at the same time.
-SendSQL("LOCK TABLES bugs WRITE, longdescs WRITE, cc WRITE, profiles READ") if Param("shadowdb");
+SendSQL("LOCK TABLES bugs WRITE, bug_group_map WRITE, longdescs WRITE, cc WRITE, profiles READ") if Param("shadowdb");
# Add the bug report to the DB.
SendSQL($sql);
@@ -291,6 +295,12 @@ SendSQL($sql);
SendSQL("select LAST_INSERT_ID()");
my $id = FetchOneColumn();
+# Add the group restrictions
+foreach my $grouptoadd (@groupstoadd) {
+ SendSQL("INSERT INTO bug_group_map (bug_id, group_id)
+ VALUES ($id, $grouptoadd)");
+}
+
# Add the comment
SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext)
VALUES ($id, $::userid, now(), " . SqlQuote($comment) . ")");