Fix for bug 84714 and bug 88797: You can now change bug groups from the "change…

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
parent 6d307a92
...@@ -394,36 +394,35 @@ if($::usergroupset ne '0') { ...@@ -394,36 +394,35 @@ if($::usergroupset ne '0') {
# unchecked, we want to revert to 0. # unchecked, we want to revert to 0.
DoComma(); DoComma();
$::query .= "groupset = 0"; $::query .= "groupset = 0";
SendSQL("select bit from groups ". my ($id) = (@idlist);
"where bit & $::usergroupset != 0 ". SendSQL(<<_EOQ_);
"and isbuggroup != 0 ". SELECT bit, bit & $::usergroupset != 0, bit & bugs.groupset != 0
"order by bit"); FROM groups, bugs
while(my $b = FetchSQLData()) { WHERE isbuggroup != 0 AND bug_id = $id
if($::FORM{"bit-$b"}) { ORDER BY bit
$::query .= " + $b"; # Carefully written so that the math is _EOQ_
# done by MySQL, which can handle 64-bit math, while (my ($b, $userhasgroup, $bughasgroup) = FetchSQLData()) {
# and not by Perl, which I *think* can not. 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
# If we're changing the groupset, then we want to check for any bits # the bug already has this group on it and the user can't access it.
# that may have been excluded because the user wasn't in that group, but if ($bughasgroup && !$userhasgroup) {
# that were set previously. $::query .= " + $b";
my $tmpbugid = 0; }
if(defined $::FORM{'id'}) { } elsif ($::FORM{"bit-$b"} == -1) {
$tmpbugid = $::FORM{'id'}; # If we get here, the user came from the change several bugs form, and
} else { # said not to change this group restriction. So we'll add this group
$tmpbugid = (grep(/^id_/, (keys %::FORM)))[0]; # back in only if the bug already has it.
$tmpbugid =~ s/^id_//; if ($bughasgroup) {
} $::query .= " + $b";
SendSQL("select sum(bit) from groups ". }
"LEFT JOIN bugs ON bugs.groupset & bit != 0 ". } else {
"where bugs.bug_id = $tmpbugid ". # If we get here, the user said to set this group. If they don't have
"and bit & $::usergroupset = 0 ". # access to it, we'll use what's already on the bug, otherwise we'll
"and isbuggroup != 0"); # add this one in.
if(MoreSQLData()) { if ($userhasgroup || $bughasgroup) {
my ($bitsum) = FetchSQLData(); $::query .= " + $b";
if($bitsum =~ /^\d+$/) { }
$::query .= " + $bitsum";
} }
} }
} }
......
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