]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 418863: Bugzilla 3.0.x lets you mark bugs as VERIFIED or CLOSED with no resolutio...
authorlpsolit%gmail.com <>
Wed, 27 Feb 2008 02:55:35 +0000 (02:55 +0000)
committerlpsolit%gmail.com <>
Wed, 27 Feb 2008 02:55:35 +0000 (02:55 +0000)
process_bug.cgi
template/en/default/global/user-error.html.tmpl

index 901b8c50f021d85e6005b647d38196155098af77..b2655919bbe9a624df0a93778ccfe5438ebd6e7f 100755 (executable)
@@ -1098,6 +1098,21 @@ if (defined $cgi->param('qa_contact')
     }
 }
 
+sub check_bugs_resolution {
+    my $idlist = shift;
+    my $dbh = Bugzilla->dbh;
+
+    my $open_states = join(',', map {$dbh->quote($_)} BUG_STATE_OPEN);
+    # The list has already been validated.
+    $idlist = join(',', @$idlist);
+    my $is_open =
+      $dbh->selectrow_array("SELECT 1 FROM bugs WHERE bug_id IN ($idlist)
+                             AND bug_status IN ($open_states)");
+
+    # If there is at least one open bug, then the test failed.
+    return !$is_open;
+}
+
 SWITCH: for ($cgi->param('knob')) {
     /^none$/ && do {
         last SWITCH;
@@ -1148,13 +1163,7 @@ SWITCH: for ($cgi->param('knob')) {
         else {
             # You cannot use change_resolution if there is at least
             # one open bug.
-            my $open_states = join(',', map {$dbh->quote($_)} BUG_STATE_OPEN);
-            my $idlist = join(',', @idlist);
-            my $is_open =
-              $dbh->selectrow_array("SELECT 1 FROM bugs WHERE bug_id IN ($idlist)
-                                     AND bug_status IN ($open_states)");
-
-            ThrowUserError('resolution_not_allowed') if $is_open;
+            check_bugs_resolution(\@idlist) || ThrowUserError('resolution_not_allowed');
         }
 
         ChangeResolution($bug, $cgi->param('resolution'));
@@ -1205,10 +1214,16 @@ SWITCH: for ($cgi->param('knob')) {
         last SWITCH;
     };
     /^verify$/ && CheckonComment( "verify" ) && do {
+        check_bugs_resolution(\@idlist)
+          || ThrowUserError('bug_status_not_allowed', {status => 'VERIFIED'});
+
         ChangeStatus('VERIFIED');
         last SWITCH;
     };
     /^close$/ && CheckonComment( "close" ) && do {
+        check_bugs_resolution(\@idlist)
+          || ThrowUserError('bug_status_not_allowed', {status => 'CLOSED'});
+
         # CLOSED bugs should have no time remaining.
         _remove_remaining_time();
 
index 967cbc193e78e2b005b8823fa3cc1ac327ceeb80..bb568e54b7ce2162d97287fb39c2b2e81f3ea5e8 100644 (file)
     [% title = "Classification Not Enabled" %]
     Sorry, classification is not enabled.
 
+  [% ELSIF error == "bug_status_not_allowed" %]
+    [% title = "Bug Status Not Allowed" %]
+    You cannot mark open [% terms.bugs %] as [% status_descs.$status FILTER html %].
+    You have to mark them as [% status_descs.RESOLVED FILTER html %] first.
+
   [% ELSIF error == "classification_not_specified" %]
     [% title = "You Must Supply A Classification Name" %]
     You must enter a classification name.