diff options
author | Simon Green <sgreen@redhat.com> | 2013-09-26 12:14:09 +1000 |
---|---|---|
committer | Simon Green <sgreen@redhat.com> | 2013-09-26 12:14:09 +1000 |
commit | c68746c717f91bb258b33d7bba5f1ac03fda4265 (patch) | |
tree | 5e954ef38b8a5ff3cd9dd24dbd62c3a1b766ea6a | |
parent | Bug 455301: Don't show password box on userprefs.cgi if your auth method didn... (diff) | |
download | bugzilla-c68746c717f91bb258b33d7bba5f1ac03fda4265.tar.gz bugzilla-c68746c717f91bb258b33d7bba5f1ac03fda4265.tar.bz2 bugzilla-c68746c717f91bb258b33d7bba5f1ac03fda4265.zip |
Bug 769134 - Bugzilla unintentionally removes groups when changing products with multiple bugs
r=dkl, a=justdave
-rw-r--r-- | Bugzilla/Bug.pm | 4 | ||||
-rw-r--r-- | template/en/default/bug/process/verify-new-product.html.tmpl | 71 |
2 files changed, 62 insertions, 13 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 404aa4625..5aff21fb7 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -2523,6 +2523,10 @@ sub _set_product { OR gcm.othercontrol != ?) )', undef, (@idlist, $product->id, CONTROLMAPNA, CONTROLMAPNA)); $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) { diff --git a/template/en/default/bug/process/verify-new-product.html.tmpl b/template/en/default/bug/process/verify-new-product.html.tmpl index 77471cbcd..c712ae09a 100644 --- a/template/en/default/bug/process/verify-new-product.html.tmpl +++ b/template/en/default/bug/process/verify-new-product.html.tmpl @@ -140,19 +140,64 @@ [% IF optional_groups.size %] <p>These groups are optional. You can decide to restrict [% terms.bugs %] to one or more of the following groups:<br> - [% 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> + [% IF multiple_bugs %] + [% USE Bugzilla %] + <script type="text/javascript"> + function turn_off(myself, id) { + var other_checkbox = document.getElementById(id); + if (myself.checked && other_checkbox) { + other_checkbox.checked = false; + } + } + </script> + + <table border="1"> + <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 %] </p> [% END %] |