Commit 79ec2997 authored by Gervase Markham's avatar Gervase Markham

Bug 1007605 - Make FIXED non-fixed, by changing noresolveonopenblockers to…

Bug 1007605 - Make FIXED non-fixed, by changing noresolveonopenblockers to define what the fixed resolution is. r,a=glob
parent 2c82105b
...@@ -1937,11 +1937,12 @@ sub _check_resolution { ...@@ -1937,11 +1937,12 @@ sub _check_resolution {
# Don't allow open bugs to have resolutions. # Don't allow open bugs to have resolutions.
ThrowUserError('resolution_not_allowed') if $is_open; ThrowUserError('resolution_not_allowed') if $is_open;
# Check noresolveonopenblockers. # Check if resolution_forbidden_with_open_blockers.
my $dependson = ref($invocant) ? $invocant->dependson my $dependson = ref($invocant) ? $invocant->dependson
: ($params->{dependson} || []); : ($params->{dependson} || []);
if (Bugzilla->params->{"noresolveonopenblockers"} if (Bugzilla->params->{"resolution_forbidden_with_open_blockers"}
&& $resolution eq 'FIXED' && $resolution eq
Bugzilla->params->{"resolution_forbidden_with_open_blockers"}
&& (!ref $invocant or !$invocant->resolution && (!ref $invocant or !$invocant->resolution
or $resolution ne $invocant->resolution) or $resolution ne $invocant->resolution)
&& scalar @$dependson) && scalar @$dependson)
......
...@@ -204,6 +204,10 @@ sub update_params { ...@@ -204,6 +204,10 @@ sub update_params {
$new_params{'search_allow_no_criteria'} = $param->{'specific_search_allow_empty_words'}; $new_params{'search_allow_no_criteria'} = $param->{'specific_search_allow_empty_words'};
} }
if (exists $param->{'noresolveonopenblockers'}) {
$new_params{'resolution_forbidden_with_open_blockers'} = $param->{'noresolveonopenblockers'} ? 'FIXED' : "";
}
# --- DEFAULTS FOR NEW PARAMS --- # --- DEFAULTS FOR NEW PARAMS ---
_load_params unless %params; _load_params unless %params;
......
...@@ -31,6 +31,10 @@ sub get_param_list { ...@@ -31,6 +31,10 @@ sub get_param_list {
@closed_bug_statuses = @current_closed_states if scalar(@current_closed_states); @closed_bug_statuses = @current_closed_states if scalar(@current_closed_states);
}; };
my $resolution_field = Bugzilla::Field->new({ name => 'resolution', cache => 1 });
# The empty resolution is included - it represents "no value"
my @resolutions = map {$_->name} @{ $resolution_field->legal_values };
my @param_list = ( my @param_list = (
{ {
name => 'duplicate_or_move_bug_status', name => 'duplicate_or_move_bug_status',
...@@ -71,10 +75,13 @@ sub get_param_list { ...@@ -71,10 +75,13 @@ sub get_param_list {
}, },
{ {
name => 'noresolveonopenblockers', name => 'resolution_forbidden_with_open_blockers',
type => 'b', type => 's',
default => 0, choices => \@resolutions,
default => '',
checker => \&check_resolution,
} ); } );
return @param_list; return @param_list;
} }
......
...@@ -28,7 +28,7 @@ use parent qw(Exporter); ...@@ -28,7 +28,7 @@ use parent qw(Exporter);
check_ip check_mail_delivery_method check_notification check_ip check_mail_delivery_method check_notification
check_bug_status check_smtp_auth check_theschwartz_available check_bug_status check_smtp_auth check_theschwartz_available
check_maxattachmentsize check_email check_smtp_ssl check_maxattachmentsize check_email check_smtp_ssl
check_comment_taggers_group check_smtp_server check_comment_taggers_group check_smtp_server check_resolution
); );
# Checking functions for the various values # Checking functions for the various values
...@@ -164,6 +164,18 @@ sub check_bug_status { ...@@ -164,6 +164,18 @@ sub check_bug_status {
return ""; return "";
} }
sub check_resolution {
my $resolution = shift;
my $resolution_field = Bugzilla::Field->new({ name => 'resolution', cache => 1 });
# The empty resolution is included - it represents "no value"
my @resolutions = map {$_->name} @{ $resolution_field->legal_values };
if (!grep($_ eq $resolution, @resolutions)) {
return "Must be blank or a valid resolution: one of " . join(', ', @resolutions);
}
return "";
}
sub check_group { sub check_group {
my $group_name = shift; my $group_name = shift;
return "" unless $group_name; return "" unless $group_name;
...@@ -464,6 +476,8 @@ valid group is provided. ...@@ -464,6 +476,8 @@ valid group is provided.
=item check_bug_status =item check_bug_status
=item check_resolution
=item check_shadowdb =item check_shadowdb
=item check_smtp_server =item check_smtp_server
......
...@@ -88,8 +88,7 @@ sub is_static { ...@@ -88,8 +88,7 @@ sub is_static {
# If we need to special-case Resolution for *anything* else, it should # If we need to special-case Resolution for *anything* else, it should
# get its own subclass. # get its own subclass.
if ($self->field->name eq 'resolution') { if ($self->field->name eq 'resolution') {
return grep($_ eq $self->name, ('', 'FIXED', 'DUPLICATE')) return $self->name eq '' || $self->name eq 'DUPLICATE';
? 1 : 0;
} }
elsif ($self->field->custom) { elsif ($self->field->custom) {
return $self->name eq '---' ? 1 : 0; return $self->name eq '---' ? 1 : 0;
......
...@@ -71,10 +71,10 @@ use constant PARAMETERS_LOGGED_IN => qw( ...@@ -71,10 +71,10 @@ use constant PARAMETERS_LOGGED_IN => qw(
maxattachmentsize maxattachmentsize
maxlocalattachment maxlocalattachment
musthavemilestoneonaccept musthavemilestoneonaccept
noresolveonopenblockers
password_complexity password_complexity
rememberlogin rememberlogin
requirelogin requirelogin
resolution_forbidden_with_open_blockers
search_allow_no_criteria search_allow_no_criteria
urlbase urlbase
use_see_also use_see_also
...@@ -428,10 +428,10 @@ A logged-in user can access the following parameters (listed alphabetically): ...@@ -428,10 +428,10 @@ A logged-in user can access the following parameters (listed alphabetically):
C<maxattachmentsize>, C<maxattachmentsize>,
C<maxlocalattachment>, C<maxlocalattachment>,
C<musthavemilestoneonaccept>, C<musthavemilestoneonaccept>,
C<noresolveonopenblockers>,
C<password_complexity>, C<password_complexity>,
C<rememberlogin>, C<rememberlogin>,
C<requirelogin>, C<requirelogin>,
C<resolution_forbidden_with_open_blockers>,
C<search_allow_no_criteria>, C<search_allow_no_criteria>,
C<urlbase>, C<urlbase>,
C<use_see_also>, C<use_see_also>,
......
...@@ -280,12 +280,14 @@ commenton* ...@@ -280,12 +280,14 @@ commenton*
any comment as to what the fix was (or even that it was truly any comment as to what the fix was (or even that it was truly
fixed!) fixed!)
noresolveonopenblockers resolution_forbidden_with_open_blockers
This option will prevent users from resolving bugs as FIXED if This option will prevent users from resolving bugs as the chosen resolution
they have unresolved dependencies. Only the FIXED resolution if they have unresolved dependencies. If using Bugzilla's default
is affected. Users will be still able to resolve bugs to resolutions, the most common value to choose is FIXED, because if a bug
resolutions other than FIXED if they have unresolved dependent is fixed, either is dependencies are actually fixed (and should be marked
bugs. as such) or the dependency is mistaken and should be removed. Only the
chosen resolution is affected; users will be still able to resolve bugs to
other resolutions even if they have unresolved dependent bugs.
.. _param-bugfields: .. _param-bugfields:
......
...@@ -187,10 +187,10 @@ Example response for authenticated user: ...@@ -187,10 +187,10 @@ Example response for authenticated user:
"maxattachmentsize" : "1000", "maxattachmentsize" : "1000",
"maxlocalattachment" : "0", "maxlocalattachment" : "0",
"musthavemilestoneonaccept" : "0", "musthavemilestoneonaccept" : "0",
"noresolveonopenblockers" : "0",
"password_complexity" : "no_constraints", "password_complexity" : "no_constraints",
"rememberlogin" : "on", "rememberlogin" : "on",
"requirelogin" : "0", "requirelogin" : "0",
"resolution_forbidden_with_open_blockers" : "FIXED",
"urlbase" : "http://bugzilla.example.com/", "urlbase" : "http://bugzilla.example.com/",
"use_see_also" : "1", "use_see_also" : "1",
"useclassification" : "1", "useclassification" : "1",
...@@ -225,10 +225,10 @@ A logged-in user can access the following parameters (listed alphabetically): ...@@ -225,10 +225,10 @@ A logged-in user can access the following parameters (listed alphabetically):
* maxattachmentsize * maxattachmentsize
* maxlocalattachment * maxlocalattachment
* musthavemilestoneonaccept * musthavemilestoneonaccept
* noresolveonopenblockers
* password_complexity * password_complexity
* rememberlogin * rememberlogin
* requirelogin * requirelogin
* resolution_forbidden_with_open_blockers
* search_allow_no_criteria * search_allow_no_criteria
* urlbase * urlbase
* use_see_also * use_see_also
......
...@@ -37,6 +37,6 @@ ...@@ -37,6 +37,6 @@
commentonduplicate => "If this option is on, the user needs to enter a short comment " _ commentonduplicate => "If this option is on, the user needs to enter a short comment " _
"if the $terms.bug is marked as duplicate.", "if the $terms.bug is marked as duplicate.",
noresolveonopenblockers => "Don\'t allow $terms.bugs to be resolved as fixed " _ resolution_forbidden_with_open_blockers => "Don't allow $terms.bugs to be resolved with " _
"if they have unresolved dependencies." } "this resolution if they have unresolved dependencies." }
%] %]
...@@ -1748,7 +1748,8 @@ ...@@ -1748,7 +1748,8 @@
[% END %]. [% END %].
They must either be resolved or removed from the They must either be resolved or removed from the
"[% field_descs.dependson FILTER html %]" field before you can resolve "[% field_descs.dependson FILTER html %]" field before you can resolve
this [% terms.bug %] as [% display_value("resolution", "FIXED") FILTER html %]. this [% terms.bug %] as [% display_value("resolution",
Param('resolution_forbidden_with_open_blockers')) FILTER html %].
[% ELSIF error == "sudo_invalid_cookie" %] [% ELSIF error == "sudo_invalid_cookie" %]
[% title = "Invalid Sudo Cookie" %] [% title = "Invalid Sudo Cookie" %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment