Commit 7962c876 authored by travis%sedsystems.ca's avatar travis%sedsystems.ca

Bug 283139 : Zero out 'hours remaining' field on certain state transitions r.t.…

Bug 283139 : Zero out 'hours remaining' field on certain state transitions r.t. throwing an error saying it's not zeroed out. Patch by Shane H. W. Travis <travis@sedsystems.ca> r=LpSolit a=justdave
parent 8b0a6508
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
# Dave Miller <justdave@syndicomm.com> # Dave Miller <justdave@syndicomm.com>
# Christopher Aillon <christopher@aillon.com> # Christopher Aillon <christopher@aillon.com>
# Myk Melez <myk@mozilla.org> # Myk Melez <myk@mozilla.org>
# Jeff Hedlund <jeff.hedlund@matrixsi.com>
# Frédéric Buclin <LpSolit@gmail.com> # Frédéric Buclin <LpSolit@gmail.com>
use strict; use strict;
...@@ -565,6 +566,21 @@ $::query = "update bugs\nset"; ...@@ -565,6 +566,21 @@ $::query = "update bugs\nset";
$::comma = ""; $::comma = "";
umask(0); umask(0);
sub _remove_remaining_time {
if (UserInGroup(Param('timetrackinggroup'))) {
if ( defined $::FORM{'remaining_time'}
&& $::FORM{'remaining_time'} > 0 )
{
$::FORM{'remaining_time'} = 0;
$vars->{'message'} = "remaining_time_zeroed";
}
}
else {
DoComma();
$::query .= "remaining_time = 0";
}
}
sub DoComma { sub DoComma {
$::query .= "$::comma\n "; $::query .= "$::comma\n ";
$::comma = ","; $::comma = ",";
...@@ -770,30 +786,6 @@ if (Param("usebugaliases") && defined($::FORM{'alias'})) { ...@@ -770,30 +786,6 @@ if (Param("usebugaliases") && defined($::FORM{'alias'})) {
} }
} }
# jeff.hedlund@matrixsi.com time tracking data processing:
if (UserInGroup(Param('timetrackinggroup'))) {
foreach my $field ("estimated_time", "remaining_time") {
if (defined $::FORM{$field}) {
my $er_time = trim($::FORM{$field});
if ($er_time ne $::FORM{'dontchange'}) {
DoComma();
$::query .= "$field = " . SqlQuote($er_time);
}
}
}
if (defined $::FORM{'deadline'}) {
DoComma();
$::query .= "deadline = ";
if ($::FORM{'deadline'}) {
Bugzilla::Util::ValidateDate($::FORM{'deadline'}, 'YYYY-MM-DD');
$::query .= SqlQuote($::FORM{'deadline'});
} else {
$::query .= "NULL" ;
}
}
}
# If the user is submitting changes from show_bug.cgi for a single bug, # If the user is submitting changes from show_bug.cgi for a single bug,
# and that bug is restricted to a group, process the checkboxes that # and that bug is restricted to a group, process the checkboxes that
# allowed the user to set whether or not the reporter # allowed the user to set whether or not the reporter
...@@ -918,12 +910,6 @@ SWITCH: for ($::FORM{'knob'}) { ...@@ -918,12 +910,6 @@ SWITCH: for ($::FORM{'knob'}) {
last SWITCH; last SWITCH;
}; };
/^resolve$/ && CheckonComment( "resolve" ) && do { /^resolve$/ && CheckonComment( "resolve" ) && do {
if (UserInGroup(Param('timetrackinggroup'))) {
if (defined $::FORM{'remaining_time'} &&
$::FORM{'remaining_time'} > 0) {
ThrowUserError("resolving_remaining_time");
}
}
# Check here, because its the only place we require the resolution # Check here, because its the only place we require the resolution
CheckFormField(\%::FORM, 'resolution', \@::settable_resolution); CheckFormField(\%::FORM, 'resolution', \@::settable_resolution);
...@@ -938,6 +924,11 @@ SWITCH: for ($::FORM{'knob'}) { ...@@ -938,6 +924,11 @@ SWITCH: for ($::FORM{'knob'}) {
dependency_count => scalar @dependencies }); dependency_count => scalar @dependencies });
} }
} }
# RESOLVED bugs should have no time remaining;
# more time can be added for the VERIFY step, if needed.
_remove_remaining_time();
ChangeStatus('RESOLVED'); ChangeStatus('RESOLVED');
ChangeResolution($::FORM{'resolution'}); ChangeResolution($::FORM{'resolution'});
last SWITCH; last SWITCH;
...@@ -992,6 +983,9 @@ SWITCH: for ($::FORM{'knob'}) { ...@@ -992,6 +983,9 @@ SWITCH: for ($::FORM{'knob'}) {
last SWITCH; last SWITCH;
}; };
/^close$/ && CheckonComment( "close" ) && do { /^close$/ && CheckonComment( "close" ) && do {
# CLOSED bugs should have no time remaining.
_remove_remaining_time();
ChangeStatus('CLOSED'); ChangeStatus('CLOSED');
last SWITCH; last SWITCH;
}; };
...@@ -1008,6 +1002,10 @@ SWITCH: for ($::FORM{'knob'}) { ...@@ -1008,6 +1002,10 @@ SWITCH: for ($::FORM{'knob'}) {
if (!defined($::FORM{'id'}) || $duplicate == $::FORM{'id'}) { if (!defined($::FORM{'id'}) || $duplicate == $::FORM{'id'}) {
ThrowUserError("dupe_of_self_disallowed"); ThrowUserError("dupe_of_self_disallowed");
} }
# DUPLICATE bugs should have no time remaining.
_remove_remaining_time();
ChangeStatus('RESOLVED'); ChangeStatus('RESOLVED');
ChangeResolution('DUPLICATE'); ChangeResolution('DUPLICATE');
$::FORM{'comment'} .= "\n\n*** This bug has been marked " . $::FORM{'comment'} .= "\n\n*** This bug has been marked " .
...@@ -1059,6 +1057,30 @@ if ($::comma eq "" ...@@ -1059,6 +1057,30 @@ if ($::comma eq ""
} }
} }
# Process data for Time Tracking fields
if (UserInGroup(Param('timetrackinggroup'))) {
foreach my $field ("estimated_time", "remaining_time") {
if (defined $::FORM{$field}) {
my $er_time = trim($::FORM{$field});
if ($er_time ne $::FORM{'dontchange'}) {
DoComma();
$::query .= "$field = " . SqlQuote($er_time);
}
}
}
if (defined $::FORM{'deadline'}) {
DoComma();
$::query .= "deadline = ";
if ($::FORM{'deadline'}) {
Bugzilla::Util::ValidateDate($::FORM{'deadline'}, 'YYYY-MM-DD');
$::query .= SqlQuote($::FORM{'deadline'});
} else {
$::query .= "NULL" ;
}
}
}
my $basequery = $::query; my $basequery = $::query;
my $delta_ts; my $delta_ts;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
[% PROCESS "global/field-descs.none.tmpl" %]
[% message_tag = message %] [% message_tag = message %]
[% message = BLOCK %] [% message = BLOCK %]
...@@ -141,6 +143,11 @@ ...@@ -141,6 +143,11 @@
or you don't have access to it. The following is a list of the or you don't have access to it. The following is a list of the
products you can choose from. products you can choose from.
[% ELSIF message_tag == "remaining_time_zeroed" %]
The [% field_descs.remaining_time FILTER html %] field has been
set to zero automatically as part of marking this [% terms.bug %]
as either RESOLVED or CLOSED.
[% ELSIF message_tag == "series_created" %] [% ELSIF message_tag == "series_created" %]
[% title = "Series Created" %] [% title = "Series Created" %]
The series <em>[% series.category FILTER html %] / The series <em>[% series.category FILTER html %] /
......
...@@ -940,11 +940,6 @@ ...@@ -940,11 +940,6 @@
[% title = "Summary Needed" %] [% title = "Summary Needed" %]
You must enter a summary for this [% terms.bug %]. You must enter a summary for this [% terms.bug %].
[% ELSIF error == "resolving_remaining_time" %]
[% title = "Trying to Resolve with Hours Remaining" %]
You cannot resolve [% terms.abug %] with hours still remaining. Set
Remaining Hours to zero if you want to resolve the [% terms.bug %].
[% ELSIF error == "sanity_check_access_denied" %] [% ELSIF error == "sanity_check_access_denied" %]
[% title = "Access Denied" %] [% title = "Access Denied" %]
You do not have the permissions necessary to run a sanity check. You do not have the permissions necessary to run a sanity check.
......
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