diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index a44108fca4..79a4c240d1 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -755,7 +755,9 @@ sub create { unless defined $params->{priority}; # BMO - per-product hw/os defaults - if (!defined $params->{rep_platform} || !defined $params->{op_sys}) { + if (Bugzilla::Product->can('default_platform') + && (!defined $params->{rep_platform} || !defined $params->{op_sys})) + { if (my $product = Bugzilla::Product->new({name => $params->{product}, cache => 1})) { @@ -2015,7 +2017,8 @@ sub _check_groups { my $group = Bugzilla::Group->check_no_disclose({%args, name => $name}); # BMO : allow bugs to be always placed into some groups - if ( !$product->group_always_settable($group) + if ( !($product->can('group_always_settable') + && $product->group_always_settable($group)) && !$product->group_is_settable($group)) { ThrowUserError('group_restriction_not_allowed', {%args, name => $name}); @@ -3292,7 +3295,8 @@ sub add_group { # BMO : allow bugs to be always placed into some groups by the bug's # reporter, or by users with editbugs my $user = Bugzilla->user; - if (!$self->product_obj->group_always_settable($group) + if (!($self->product_obj->can('group_always_settable') + && $self->product_obj->group_always_settable($group)) || ($self->{reporter_id} != $user->id && !$user->in_group('editbugs'))) { # Make sure that bugs in this product can actually be restricted diff --git a/Bugzilla/Test/MockDB.pm b/Bugzilla/Test/MockDB.pm index 0222c62864..6659ac43a6 100644 --- a/Bugzilla/Test/MockDB.pm +++ b/Bugzilla/Test/MockDB.pm @@ -216,16 +216,16 @@ sub import { $class_id = Bugzilla::Classification->new({name => $product->{classification}})->id; } - $dbh->do( - 'INSERT INTO products (name, description, classification_id, - default_op_sys_id, default_platform_id) - VALUES (?, ?, ?, ?, ?)', - undef, - ( - $product->{product_name}, $product->{description}, $class_id, - $default_op_sys_id, $default_platform_id - ) - ); + my @cols = qw(name description classification_id); + my @vals + = ($product->{product_name}, $product->{description}, $class_id); + if ($dbh->bz_column_info('products', 'default_op_sys_id')) { + push @cols, qw(default_op_sys_id default_platform_id); + push @vals, $default_op_sys_id, $default_platform_id; + } + $dbh->do('INSERT INTO products (' . join(', ', @cols) + . ') VALUES (' . join(', ', ('?') x @cols) . ')', + undef, @vals); $new_product = new Bugzilla::Product({name => $product->{product_name}}); diff --git a/Bugzilla/WebService/Product.pm b/Bugzilla/WebService/Product.pm index 4e38f85122..0a81432d48 100644 --- a/Bugzilla/WebService/Product.pm +++ b/Bugzilla/WebService/Product.pm @@ -199,13 +199,18 @@ sub _product_to_hash { } # 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); + if ($product->can('default_platform')) { + $field_data->{default_platform} + = $self->type('string', $product->default_platform); + $field_data->{default_op_sys} + = $self->type('string', $product->default_op_sys); + } # BMO - add default security group - $field_data->{default_security_group} - = $self->type('string', $product->default_security_group); + if ($product->can('default_security_group')) { + $field_data->{default_security_group} + = $self->type('string', $product->default_security_group); + } return filter($params, $field_data); } diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm index 25f3fe68f8..24671cda7f 100644 --- a/Bugzilla/WebService/User.pm +++ b/Bugzilla/WebService/User.pm @@ -513,7 +513,7 @@ sub _user_from_phab_token { # `user.whoami` endpoint. # only if PhabBugz is configure and X-PHABRICATOR-TOKEN is provided - (my $phab_url = Bugzilla->params->{phabricator_base_uri}) =~ s{/$}{}; + (my $phab_url = Bugzilla->params->{phabricator_base_uri} // '') =~ s{/$}{}; my $phab_token = Bugzilla->input_params->{Phabricator_token}; return undef unless $phab_url && $phab_token; diff --git a/enter_bug.cgi b/enter_bug.cgi index ace005ea2c..0cecaa177f 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -323,9 +323,9 @@ else { # BMO - use per-product default hw/os $default{'rep_platform'} - = formvalue('rep_platform', $product->default_platform // detect_platform()); + = formvalue('rep_platform', ($product->can('default_platform') ? $product->default_platform : undef) // detect_platform()); $default{'op_sys'} - = formvalue('op_sys', $product->default_op_sys // detect_op_sys()); + = formvalue('op_sys', ($product->can('default_op_sys') ? $product->default_op_sys : undef) // detect_op_sys()); $vars->{'rep_platform'} = detect_platform(); $vars->{'rep_op_sys'} = detect_op_sys(); diff --git a/extensions/BMO/disabled b/extensions/BMO/disabled new file mode 100644 index 0000000000..e69de29bb2 diff --git a/extensions/BMO/template/en/default/hook/bug/create/create-end.html.tmpl b/extensions/BMO/template/en/default/hook/bug/create/create-end.html.tmpl index 8559c416f1..79e22d5d03 100644 --- a/extensions/BMO/template/en/default/hook/bug/create/create-end.html.tmpl +++ b/extensions/BMO/template/en/default/hook/bug/create/create-end.html.tmpl @@ -31,3 +31,11 @@ product. + +
diff --git a/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl index 1bbf1dcdf3..b7135d85ec 100644 --- a/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl +++ b/extensions/BMO/template/en/default/hook/global/user-error-errors.html.tmpl @@ -22,10 +22,6 @@ [% title = "Missing Username" %] You must provide at least one email address to report on. -[% ELSIF error == "report_invalid_date" %] - [% title = "Invalid Date" %] - The date '[% date FILTER html %]' is invalid. - [% ELSIF error == "report_invalid_parameter" %] [% title = "Invalid Parameter" %] The value for parameter [% name FILTER html %] is invalid. diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm index 6d7c3f224c..eea1ed6baf 100644 --- a/extensions/BugModal/lib/WebService.pm +++ b/extensions/BugModal/lib/WebService.pm @@ -332,8 +332,15 @@ sub new_product { } } - my $default_group_name = $product->default_security_group; - if (my $default_group + my $default_group_name + = $product->can('default_security_group') + ? $product->default_security_group + : undef; + if (!defined $default_group_name) { + + # no per-product default security group without the BMO extension + } + elsif (my $default_group = first_value { $_->{group}->name eq $default_group_name } @groups) { # because we always allow the default product group to be selected, it's never invalid diff --git a/extensions/BugModal/template/en/default/bug_modal/groups.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/groups.html.tmpl index 16ba919d69..85aba6ec5a 100644 --- a/extensions/BugModal/template/en/default/bug_modal/groups.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/groups.html.tmpl @@ -48,7 +48,8 @@