diff options
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-x | post_bug.cgi | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/post_bug.cgi b/post_bug.cgi index a1ed77bac..ccdda3e2d 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -73,11 +73,14 @@ my $token = trim($cgi->param('token')); check_token_data($token, 'create_bug', 'index.cgi'); # do a match on the fields if applicable -Bugzilla::User::match_field ({ +# BMO: allow extensions to define custom user fields +my $user_match_fields = { 'cc' => { 'type' => 'multi' }, 'assigned_to' => { 'type' => 'single' }, 'qa_contact' => { 'type' => 'single' }, -}); +}; +Bugzilla::Hook::process('bug_user_match_fields', { fields => $user_match_fields }); +Bugzilla::User::match_field($user_match_fields); if (defined $cgi->param('maketemplate')) { $vars->{'url'} = $cgi->canonicalise_query('token'); @@ -152,6 +155,13 @@ foreach my $field (@multi_selects) { $bug_params{$field->name} = [$cgi->param($field->name)]; } +# BMO - add user_match_fields. it's important to source from input_params +# instead of $cgi->param to ensure we get the correct value. +foreach my $field (keys %$user_match_fields) { + next if exists $bug_params{$field}; + $bug_params{$field} = Bugzilla->input_params->{$field} // []; +} + my $bug = Bugzilla::Bug->create(\%bug_params); # Get the bug ID back and delete the token used to create this bug. |