]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1007605 - Make FIXED non-fixed, by changing noresolveonopenblockers to define...
authorGervase Markham <gerv@gerv.net>
Mon, 30 Mar 2015 17:53:57 +0000 (18:53 +0100)
committerGervase Markham <gerv@gerv.net>
Mon, 30 Mar 2015 17:53:57 +0000 (18:53 +0100)
Bugzilla/Bug.pm
Bugzilla/Config.pm
Bugzilla/Config/BugChange.pm
Bugzilla/Config/Common.pm
Bugzilla/Field/ChoiceInterface.pm
Bugzilla/WebService/Bugzilla.pm
docs/en/rst/administering/parameters.rst
docs/en/rst/api/core/v1/bugzilla.rst
template/en/default/admin/params/bugchange.html.tmpl
template/en/default/global/user-error.html.tmpl

index 2bd6fb646f39d020997c7bd614406935e398ec23..fc5dbc678e2e9e218e3e1a46e2cefedc690f3ffe 100644 (file)
@@ -1937,11 +1937,12 @@ sub _check_resolution {
     # Don't allow open bugs to have resolutions.
     ThrowUserError('resolution_not_allowed') if $is_open;
     
-    # Check noresolveonopenblockers.
+    # Check if resolution_forbidden_with_open_blockers.
     my $dependson = ref($invocant) ? $invocant->dependson
                                    : ($params->{dependson} || []);
-    if (Bugzilla->params->{"noresolveonopenblockers"}
-        && $resolution eq 'FIXED'
+    if (Bugzilla->params->{"resolution_forbidden_with_open_blockers"}
+        && $resolution eq
+                  Bugzilla->params->{"resolution_forbidden_with_open_blockers"}
         && (!ref $invocant or !$invocant->resolution 
             or $resolution ne $invocant->resolution)
         && scalar @$dependson)
index ebd5f8ef6c4a61ee2ce610ec41f83ea5ddd5ae3c..51d65397ee2468662f1115cadc99970cdd3e7954 100644 (file)
@@ -204,6 +204,10 @@ sub update_params {
         $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 ---
 
     _load_params unless %params;
index 0acdc0ce49cfdb2f8a04e23e279261e50278081a..2a225b794f66aca020c7769920f25793e9936713 100644 (file)
@@ -31,6 +31,10 @@ sub get_param_list {
       @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 = (
   {
    name => 'duplicate_or_move_bug_status',
@@ -71,10 +75,13 @@ sub get_param_list {
   },
 
   {
-   name    => 'noresolveonopenblockers',
-   type    => 'b',
-   default => 0,
+   name => 'resolution_forbidden_with_open_blockers',
+   type => 's',
+   choices => \@resolutions,
+   default => '',
+   checker => \&check_resolution,
   } );
+
   return @param_list;
 }
 
index 52a2f8f1165b75aa131d65e4093cedbb90429278..95b1e3189c5325c5c56f88add786a00daf76d28d 100644 (file)
@@ -28,7 +28,7 @@ use parent qw(Exporter);
        check_ip check_mail_delivery_method check_notification
        check_bug_status check_smtp_auth check_theschwartz_available
        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
@@ -164,6 +164,18 @@ sub check_bug_status {
     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 {
     my $group_name = shift;
     return "" unless $group_name;
@@ -464,6 +476,8 @@ valid group is provided.
 
 =item check_bug_status
 
+=item check_resolution
+
 =item check_shadowdb
 
 =item check_smtp_server
index 634d36ad1272eb35434837d92f9a5eece499e1c1..9ac508dc030a662aabd4644a671f241288c89d5e 100644 (file)
@@ -88,8 +88,7 @@ sub is_static {
     # If we need to special-case Resolution for *anything* else, it should
     # get its own subclass.
     if ($self->field->name eq 'resolution') {
-        return grep($_ eq $self->name, ('', 'FIXED', 'DUPLICATE'))
-               ? 1 : 0;
+        return $self->name eq '' || $self->name eq 'DUPLICATE';
     }
     elsif ($self->field->custom) {
         return $self->name eq '---' ? 1 : 0;
index 45ef326ac7243de63a8c389374b5f57f500d24ed..f94ea55c97388552b663acd63a54aa93ba33547d 100644 (file)
@@ -71,10 +71,10 @@ use constant PARAMETERS_LOGGED_IN => qw(
     maxattachmentsize
     maxlocalattachment
     musthavemilestoneonaccept
-    noresolveonopenblockers
     password_complexity
     rememberlogin
     requirelogin
+    resolution_forbidden_with_open_blockers
     search_allow_no_criteria
     urlbase
     use_see_also
@@ -428,10 +428,10 @@ A logged-in user can access the following parameters (listed alphabetically):
     C<maxattachmentsize>,
     C<maxlocalattachment>,
     C<musthavemilestoneonaccept>,
-    C<noresolveonopenblockers>,
     C<password_complexity>,
     C<rememberlogin>,
     C<requirelogin>,
+    C<resolution_forbidden_with_open_blockers>,
     C<search_allow_no_criteria>,
     C<urlbase>,
     C<use_see_also>,
index 44eae8e51e818c694ba0b52e30745f54ff3d2890..80611ef6e8eb6b3e954944aac481bdc7e53d1da2 100644 (file)
@@ -280,12 +280,14 @@ commenton*
        any comment as to what the fix was (or even that it was truly
        fixed!)
 
-noresolveonopenblockers
-    This option will prevent users from resolving bugs as FIXED if
-    they have unresolved dependencies. Only the FIXED resolution
-    is affected. Users will be still able to resolve bugs to
-    resolutions other than FIXED if they have unresolved dependent
-    bugs.
+resolution_forbidden_with_open_blockers
+    This option will prevent users from resolving bugs as the chosen resolution
+    if they have unresolved dependencies. If using Bugzilla's default
+    resolutions, the most common value to choose is FIXED, because if a bug
+    is fixed, either is dependencies are actually fixed (and should be marked
+    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:
 
index b066eca0ca34c7ebd00b2627aac8327924382aef..67029cc1ff6fff02cec1d560d6d14215139e79a6 100644 (file)
@@ -187,10 +187,10 @@ Example response for authenticated user:
           "maxattachmentsize" : "1000",
           "maxlocalattachment" : "0",
           "musthavemilestoneonaccept" : "0",
-          "noresolveonopenblockers" : "0",
           "password_complexity" : "no_constraints",
           "rememberlogin" : "on",
           "requirelogin" : "0",
+          "resolution_forbidden_with_open_blockers" : "FIXED",
           "urlbase" : "http://bugzilla.example.com/",
           "use_see_also" : "1",
           "useclassification" : "1",
@@ -225,10 +225,10 @@ A logged-in user can access the following parameters (listed alphabetically):
 * maxattachmentsize
 * maxlocalattachment
 * musthavemilestoneonaccept
-* noresolveonopenblockers
 * password_complexity
 * rememberlogin
 * requirelogin
+* resolution_forbidden_with_open_blockers
 * search_allow_no_criteria
 * urlbase
 * use_see_also
index f442c59533101b8426842b33204401071535317f..4d73e0cb1d5bf72bb8bde7461d6eb1f485960cd6 100644 (file)
@@ -37,6 +37,6 @@
   commentonduplicate => "If this option is on, the user needs to enter a short comment " _
                         "if the $terms.bug is marked as duplicate.",
 
-  noresolveonopenblockers => "Don\'t allow $terms.bugs to be resolved as fixed " _
-                             "if they have unresolved dependencies." }
+  resolution_forbidden_with_open_blockers => "Don't allow $terms.bugs to be resolved with " _
+                             "this resolution if they have unresolved dependencies." }
 %]
index dd34f2cd626d81e3e0957bbbf4f4b1bba1da1857..299e2a1946fd55376e787e3882009291606aa69a 100644 (file)
     [% END %].
     They must either be resolved or removed from the
     "[% 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" %]
     [% title = "Invalid Sudo Cookie" %]