From: lpsolit%gmail.com <> Date: Wed, 27 Feb 2008 02:55:35 +0000 (+0000) Subject: Bug 418863: Bugzilla 3.0.x lets you mark bugs as VERIFIED or CLOSED with no resolutio... X-Git-Tag: bugzilla-3.0.4~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d46608f1983158d7c9d5493415ee31e87d09274d;p=thirdparty%2Fbugzilla.git Bug 418863: Bugzilla 3.0.x lets you mark bugs as VERIFIED or CLOSED with no resolution - Patch by Frédéric Buclin r=mkanat a=LpSolit --- diff --git a/process_bug.cgi b/process_bug.cgi index 901b8c50f0..b2655919bb 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -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(); diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 967cbc193e..bb568e54b7 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -250,6 +250,11 @@ [% 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.