From: Kohei Yoshino Date: Tue, 23 Apr 2019 22:26:18 +0000 (-0400) Subject: Bug 1543741 - Blocklist requests getting filed as 'defect' instead of 'task' because... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a98a594908107f01b6304ea12286cf7df829f16d;p=thirdparty%2Fbugzilla.git Bug 1543741 - Blocklist requests getting filed as 'defect' instead of 'task' because of custom form --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index ac96a7729..25cbadb28 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -900,13 +900,29 @@ sub create { $dbh->bz_start_transaction(); # These fields have default values which we can use if they are undefined. - $params->{bug_type} = Bugzilla->params->{default_bug_type} - unless defined $params->{bug_type}; $params->{bug_severity} = Bugzilla->params->{defaultseverity} unless defined $params->{bug_severity}; $params->{priority} = Bugzilla->params->{defaultpriority} unless defined $params->{priority}; + # Bug type can be defined at the component, product or instance level + unless (defined $params->{bug_type}) { + my $product + = (defined $params->{product}) + ? Bugzilla::Product->new({name => $params->{product}, cache => 1}) + : undef; + my $component + = ($product && defined $params->{component}) + ? Bugzilla::Component->new({name => $params->{component}, product => $product, cache => 1}) + : undef; + # The component's default bug type inherits or overrides the default bug + # type of the product or instance + $params->{bug_type} + = ($component) + ? $component->default_bug_type + : Bugzilla->params->{default_bug_type}; + } + # BMO - per-product hw/os defaults if (!defined $params->{rep_platform} || !defined $params->{op_sys}) { if (my $product