]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 460074: Make post_bug.cgi use should_set for array fields, so they
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 16 Aug 2011 00:48:26 +0000 (17:48 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 16 Aug 2011 00:48:26 +0000 (17:48 -0700)
are undef in Bugzilla::Bug->create if not passed to post_bug. This fixes
a bug with the guided bug form creating bugs without any groups.
r=LpSolit, a=mkanat

post_bug.cgi
template/en/default/bug/create/create.html.tmpl

index 6d6ed746ca0de692a048cdb021b7c4d8737153f1..6ca46fb3c1ffadbaa86ec251f01371285707a366 100755 (executable)
@@ -153,14 +153,17 @@ my %bug_params;
 foreach my $field (@bug_fields) {
     $bug_params{$field} = $cgi->param($field);
 }
-$bug_params{'cc'}          = [$cgi->param('cc')];
-$bug_params{'groups'}      = [$cgi->param('groups')];
-$bug_params{'comment'}     = $comment;
+foreach my $field (qw(cc groups)) {
+    next if !$cgi->should_set($field);
+    $bug_params{$field} = [$cgi->param($field)];
+}
+$bug_params{'comment'} = $comment;
 
 my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT && $_->enter_bug}
                          Bugzilla->active_custom_fields;
 
 foreach my $field (@multi_selects) {
+    next if !$cgi->should_set($field->name);
     $bug_params{$field->name} = [$cgi->param($field->name)];
 }
 
index 8604f0839767de8662fe229d8d5822d8a1c3c27f..ee19ab5d656c82a266031714b4702b7d86187f08 100644 (file)
@@ -665,6 +665,7 @@ TUI_hide_default('attachment_text_field');
       <br>
 
       <!-- Checkboxes -->
+      <input type="hidden" name="defined_groups" value="1">
       [% FOREACH group = product.groups_available %]
         <input type="checkbox" id="group_[% group.id FILTER html %]"
                name="groups" value="[% group.name FILTER html %]"