diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Bug.pm | 13 | ||||
-rw-r--r-- | Bugzilla/UserAgent.pm | 4 | ||||
-rw-r--r-- | Bugzilla/WebService/Product.pm | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index e1f533274..6dbcffe34 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -702,10 +702,15 @@ sub create { unless defined $params->{bug_severity}; $params->{priority} = Bugzilla->params->{defaultpriority} unless defined $params->{priority}; - $params->{op_sys} = Bugzilla->params->{defaultopsys} - unless defined $params->{op_sys}; - $params->{rep_platform} = Bugzilla->params->{defaultplatform} - unless defined $params->{rep_platform}; + + # BMO - per-product hw/os defaults + if (!defined $params->{rep_platform} || !defined $params->{op_sys}) { + if (my $product = Bugzilla::Product->new({ name => $params->{product}, cache => 1 })) { + $params->{rep_platform} //= $product->default_product; + $params->{op_sys} //= $product->default_op_sys; + } + } + # Make sure a comment is always defined. $params->{comment} = '' unless defined $params->{comment}; diff --git a/Bugzilla/UserAgent.pm b/Bugzilla/UserAgent.pm index 62d6115a9..9c8686f0c 100644 --- a/Bugzilla/UserAgent.pm +++ b/Bugzilla/UserAgent.pm @@ -183,7 +183,7 @@ use constant OS_MAP => ( ); sub detect_platform { - my $userAgent = $ENV{'HTTP_USER_AGENT'} || ''; + my $userAgent = shift || Bugzilla->cgi->user_agent || ''; my @detected; my $iterator = natatime(2, PLATFORMS_MAP); while (my($re, $ra) = $iterator->()) { @@ -195,7 +195,7 @@ sub detect_platform { } sub detect_op_sys { - my $userAgent = $ENV{'HTTP_USER_AGENT'} || ''; + my $userAgent = shift || Bugzilla->cgi->user_agent || ''; my @detected; my $iterator = natatime(2, OS_MAP); while (my($re, $ra) = $iterator->()) { diff --git a/Bugzilla/WebService/Product.pm b/Bugzilla/WebService/Product.pm index be082c778..b7484327f 100644 --- a/Bugzilla/WebService/Product.pm +++ b/Bugzilla/WebService/Product.pm @@ -202,6 +202,9 @@ sub _product_to_hash { $self->_milestone_to_hash($_, $params) } @{$product->milestones}]; } + # BMO - add default hw/os + $field_data->{default_platform} = $self->type('string', $product->default_platform); + $field_data->{default_op_sys} = $self->type('string', $product->default_op_sys); return filter($params, $field_data); } |