Commit 53d3d353 authored by zach%zachlipton.com's avatar zach%zachlipton.com

fix for bug 66235: process_bug.cgi: multiple product change misses the groupset…

fix for bug 66235: process_bug.cgi: multiple product change misses the groupset bit. Patch by Myk <myk@mozilla.org> r=Jake, oh, and it's my first checkin, yahoo!
parent f140d478
...@@ -1108,6 +1108,16 @@ sub UserInGroup { ...@@ -1108,6 +1108,16 @@ sub UserInGroup {
return 0; return 0;
} }
sub BugInGroup {
my ($bugid, $groupname) = (@_);
my $groupbit = GroupNameToBit($groupname);
PushGlobalSQLState();
SendSQL("SELECT (bugs.groupset & $groupbit) != 0 FROM bugs WHERE bugs.bug_id = $bugid");
my $bugingroup = FetchOneColumn();
PopGlobalSQLState();
return $bugingroup;
}
sub GroupExists { sub GroupExists {
my ($groupname) = (@_); my ($groupname) = (@_);
ConnectToDatabase(); ConnectToDatabase();
...@@ -1116,11 +1126,25 @@ sub GroupExists { ...@@ -1116,11 +1126,25 @@ sub GroupExists {
return $count; return $count;
} }
# Given the name of an existing group, returns the bit associated with it.
# If the group does not exist, returns 0.
# !!! Remove this function when the new group system is implemented!
sub GroupNameToBit {
my ($groupname) = (@_);
ConnectToDatabase();
PushGlobalSQLState();
SendSQL("SELECT bit FROM groups WHERE name = " . SqlQuote($groupname));
my $bit = FetchOneColumn() || 0;
PopGlobalSQLState();
return $bit;
}
# Determines whether or not a group is active by checking # Determines whether or not a group is active by checking
# the "isactive" column for the group in the "groups" table. # the "isactive" column for the group in the "groups" table.
# Note: This function selects groups by bit rather than by name. # Note: This function selects groups by bit rather than by name.
sub GroupIsActive { sub GroupIsActive {
my ($groupbit) = (@_); my ($groupbit) = (@_);
$groupbit ||= 0;
ConnectToDatabase(); ConnectToDatabase();
SendSQL("select isactive from groups where bit=$groupbit"); SendSQL("select isactive from groups where bit=$groupbit");
my $isactive = FetchOneColumn(); my $isactive = FetchOneColumn();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment