diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-23 01:24:06 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-23 01:24:06 +0100 |
commit | f6e24acaeb1e9b0f7f4eafb27bc7adf81d5dd9e2 (patch) | |
tree | 756824fb56c3da7d248f9d4820dce4cdb4f0a756 /enter_bug.cgi | |
parent | 0b85419f77869b943323c3656d8900f9ad6e1dfc (diff) | |
download | bugzilla-f6e24acaeb1e9b0f7f4eafb27bc7adf81d5dd9e2.tar.gz bugzilla-f6e24acaeb1e9b0f7f4eafb27bc7adf81d5dd9e2.tar.xz |
Bug 526184: Allow groups to be specified when creating bugs using email_in.pl
or the WebService Bug.create method.
r=LpSolit, a=LpSolit
Diffstat (limited to 'enter_bug.cgi')
-rwxr-xr-x | enter_bug.cgi | 66 |
1 files changed, 7 insertions, 59 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi index a4ed7350e..79116d592 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -555,66 +555,14 @@ else { $default{'bug_status'} = ($status[0] ne 'UNCONFIRMED') ? $status[0] : $status[1]; } -my $grouplist = $dbh->selectall_arrayref( - q{SELECT DISTINCT groups.id, groups.name, groups.description, - membercontrol, othercontrol - FROM groups - LEFT JOIN group_control_map - ON group_id = id AND product_id = ? - WHERE isbuggroup != 0 AND isactive != 0 - ORDER BY description}, undef, $product->id); - -my @groups; - -foreach my $row (@$grouplist) { - my ($id, $groupname, $description, $membercontrol, $othercontrol) = @$row; - # Only include groups if the entering user will have an option. - next if ((!$membercontrol) - || ($membercontrol == CONTROLMAPNA) - || ($membercontrol == CONTROLMAPMANDATORY) - || (($othercontrol != CONTROLMAPSHOWN) - && ($othercontrol != CONTROLMAPDEFAULT) - && (!Bugzilla->user->in_group($groupname))) - ); - my $check; - - # If this is a cloned bug, - # AND the product for this bug is the same as for the original - # THEN set a group's checkbox if the original also had it on - # ELSE IF this is a bookmarked template - # THEN set a group's checkbox if was set in the bookmark - # ELSE - # set a groups's checkbox based on the group control map - # - if ( ($cloned_bug_id) && - ($product->name eq $cloned_bug->product ) ) { - foreach my $i (0..(@{$cloned_bug->groups} - 1) ) { - if ($cloned_bug->groups->[$i]->{'bit'} == $id) { - $check = $cloned_bug->groups->[$i]->{'ison'}; - } - } - } - elsif(formvalue("maketemplate") ne "") { - $check = formvalue("bit-$id", 0); - } - else { - # Checkbox is checked by default if $control is a default state. - $check = (($membercontrol == CONTROLMAPDEFAULT) - || (($othercontrol == CONTROLMAPDEFAULT) - && (!Bugzilla->user->in_group($groupname)))); - } - - my $group = - { - 'bit' => $id , - 'checked' => $check , - 'description' => $description - }; - - push @groups, $group; +my @groups = $cgi->param('groups'); +if ($cloned_bug) { + my @clone_groups = map { $_->name } @{ $cloned_bug->groups_in }; + # It doesn't matter if there are duplicate names, since all we check + # for in the template is whether or not the group is set. + push(@groups, @clone_groups); } - -$vars->{'group'} = \@groups; +$default{'groups'} = \@groups; Bugzilla::Hook::process('enter_bug_entrydefaultvars', { vars => $vars }); |