summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-07-22 09:29:45 +0200
committerjustdave%syndicomm.com <>2001-07-22 09:29:45 +0200
commit20178355cb13498111b15beea478eb43a9afe853 (patch)
tree86319892ff77a370829cfec0016413092942edec /process_bug.cgi
parent6d307a92230b025dd7eefba00d593f1eff430b5f (diff)
downloadbugzilla-20178355cb13498111b15beea478eb43a9afe853.tar.gz
bugzilla-20178355cb13498111b15beea478eb43a9afe853.tar.xz
Fix for bug 84714 and bug 88797: You can now change bug groups from the "change several bugs" form even if the bugs aren't all in the same groups. Also, the groups are no longer cleared when you make a change from the "change several bugs" form (unless you tell it to)
Patch by Joe Robins <jmrobins@tgix.com> and Dave Miller <justdave@syndicomm.com> r= zach@zachlipton.com a= justdave@syndicomm.com
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi59
1 files changed, 29 insertions, 30 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index b5ea3c782..d42f6b84e 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -394,36 +394,35 @@ if($::usergroupset ne '0') {
# unchecked, we want to revert to 0.
DoComma();
$::query .= "groupset = 0";
- SendSQL("select bit from groups ".
- "where bit & $::usergroupset != 0 ".
- "and isbuggroup != 0 ".
- "order by bit");
- while(my $b = FetchSQLData()) {
- if($::FORM{"bit-$b"}) {
- $::query .= " + $b"; # 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.
- }
- }
- # If we're changing the groupset, then we want to check for any bits
- # that may have been excluded because the user wasn't in that group, but
- # that were set previously.
- my $tmpbugid = 0;
- if(defined $::FORM{'id'}) {
- $tmpbugid = $::FORM{'id'};
- } else {
- $tmpbugid = (grep(/^id_/, (keys %::FORM)))[0];
- $tmpbugid =~ s/^id_//;
- }
- SendSQL("select sum(bit) from groups ".
- "LEFT JOIN bugs ON bugs.groupset & bit != 0 ".
- "where bugs.bug_id = $tmpbugid ".
- "and bit & $::usergroupset = 0 ".
- "and isbuggroup != 0");
- if(MoreSQLData()) {
- my ($bitsum) = FetchSQLData();
- if($bitsum =~ /^\d+$/) {
- $::query .= " + $bitsum";
+ my ($id) = (@idlist);
+ SendSQL(<<_EOQ_);
+ SELECT bit, bit & $::usergroupset != 0, bit & bugs.groupset != 0
+ FROM groups, bugs
+ WHERE isbuggroup != 0 AND bug_id = $id
+ ORDER BY bit
+_EOQ_
+ while (my ($b, $userhasgroup, $bughasgroup) = FetchSQLData()) {
+ if (!$::FORM{"bit-$b"}) {
+ # If we make it here, the item didn't exist on the form or the user
+ # said to clear it. The only time we add this group back in is if
+ # the bug already has this group on it and the user can't access it.
+ if ($bughasgroup && !$userhasgroup) {
+ $::query .= " + $b";
+ }
+ } elsif ($::FORM{"bit-$b"} == -1) {
+ # If we get here, the user came from the change several bugs form, and
+ # said not to change this group restriction. So we'll add this group
+ # back in only if the bug already has it.
+ if ($bughasgroup) {
+ $::query .= " + $b";
+ }
+ } else {
+ # If we get here, the user said to set this group. If they don't have
+ # access to it, we'll use what's already on the bug, otherwise we'll
+ # add this one in.
+ if ($userhasgroup || $bughasgroup) {
+ $::query .= " + $b";
+ }
}
}
}