Commit c68746c7 authored by Simon Green's avatar Simon Green

Bug 769134 - Bugzilla unintentionally removes groups when changing products with multiple bugs

r=dkl, a=justdave
parent 6ea028e0
...@@ -2523,6 +2523,10 @@ sub _set_product { ...@@ -2523,6 +2523,10 @@ sub _set_product {
OR gcm.othercontrol != ?) )', OR gcm.othercontrol != ?) )',
undef, (@idlist, $product->id, CONTROLMAPNA, CONTROLMAPNA)); undef, (@idlist, $product->id, CONTROLMAPNA, CONTROLMAPNA));
$vars{'old_groups'} = Bugzilla::Group->new_from_list($gids); $vars{'old_groups'} = Bugzilla::Group->new_from_list($gids);
# Did we come here from editing multiple bugs? (affects how we
# show optional group changes)
$vars{multiple_bugs} = Bugzilla->cgi->param('id') ? 0 : 1;
} }
if (%vars) { if (%vars) {
......
...@@ -140,19 +140,64 @@ ...@@ -140,19 +140,64 @@
[% IF optional_groups.size %] [% IF optional_groups.size %]
<p>These groups are optional. You can decide to restrict [% terms.bugs %] to <p>These groups are optional. You can decide to restrict [% terms.bugs %] to
one or more of the following groups:<br> one or more of the following groups:<br>
[% FOREACH group = optional_groups %] [% IF multiple_bugs %]
<input type="hidden" name="defined_groups" [% USE Bugzilla %]
value="[% group.group.name FILTER html %]"> <script type="text/javascript">
<input type="checkbox" id="group_[% group.group.id FILTER html %]" function turn_off(myself, id) {
name="groups" var other_checkbox = document.getElementById(id);
[% ' checked="checked"' IF ((group.membercontrol == constants.CONTROLMAPDEFAULT && user.in_group(group.group.name)) if (myself.checked && other_checkbox) {
|| (group.othercontrol == constants.CONTROLMAPDEFAULT && !user.in_group(group.group.name)) other_checkbox.checked = false;
|| cgi.param("groups").contains(group.group.name)) %] }
value="[% group.group.name FILTER html %]"> }
<label for="group_[% group.group.id FILTER html %]"> </script>
[% group.group.name FILTER html %]: [% group.group.description FILTER html %]
</label> <table border="1">
<br> <tr>
<th>Remove<br>[% terms.bugs %]<br>from this<br>group</th>
<th>Add<br>[% terms.bugs %]<br>to this<br>group</th>
<th>Group Name:</th>
</tr>
[% FOREACH group = optional_groups %]
<tr>
<td align="center">
<input type="checkbox" name="defined_groups"
id="defined_group_[% group.group.id FILTER html %]"
value="[% group.group.name FILTER html %]"
[% IF Bugzilla.cgi.param("defined_groups").contains(group.group.name) %] checked="checked"[% END %]
onchange="turn_off(this, 'group_[% group.group.id FILTER html %]')">
</td>
<td align="center">
<input type="checkbox" name="groups"
id="group_[% group.group.id FILTER html %]"
value="[% group.group.name FILTER html %]"
[% IF Bugzilla.cgi.param("groups").contains(group.group.name) %] checked="checked"[% END %]
onchange="turn_off(this, 'defined_group_[% group.group.id FILTER html %]')">
</td>
<td>
[% group.group.description FILTER html %]
</td>
</tr>
[% END %]
</table>
[% ELSE %]
[% FOREACH group = optional_groups %]
<input type="hidden" name="defined_groups"
value="[% group.group.name FILTER html %]">
<input type="checkbox" id="group_[% group.group.id FILTER html %]"
name="groups"
[% ' checked="checked"' IF ((group.membercontrol == constants.CONTROLMAPDEFAULT && user.in_group(group.group.name))
|| (group.othercontrol == constants.CONTROLMAPDEFAULT && !user.in_group(group.group.name))
|| cgi.param("groups").contains(group.group.name)) %]
value="[% group.group.name FILTER html %]">
<label for="group_[% group.group.id FILTER html %]">
[% group.group.name FILTER html %]: [% group.group.description FILTER html %]
</label>
<br>
[% END %]
[% END %] [% END %]
</p> </p>
[% END %] [% END %]
......
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