diff options
author | travis%sedsystems.ca <> | 2005-03-01 03:55:06 +0100 |
---|---|---|
committer | travis%sedsystems.ca <> | 2005-03-01 03:55:06 +0100 |
commit | 7962c876e52a2812cd6ab00be1c9cdabc05000ec (patch) | |
tree | 291be7536702ba45c21dd883a410b574a90af5ad /process_bug.cgi | |
parent | 8b0a6508c4daa8a56d17192a9c3a1d9b53790e15 (diff) | |
download | bugzilla-7962c876e52a2812cd6ab00be1c9cdabc05000ec.tar.gz bugzilla-7962c876e52a2812cd6ab00be1c9cdabc05000ec.tar.xz |
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
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-x | process_bug.cgi | 82 |
1 files changed, 52 insertions, 30 deletions
diff --git a/process_bug.cgi b/process_bug.cgi index 3eccfa370..ea2180c3c 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -23,6 +23,7 @@ # Dave Miller <justdave@syndicomm.com> # Christopher Aillon <christopher@aillon.com> # Myk Melez <myk@mozilla.org> +# Jeff Hedlund <jeff.hedlund@matrixsi.com> # Frédéric Buclin <LpSolit@gmail.com> use strict; @@ -565,6 +566,21 @@ $::query = "update bugs\nset"; $::comma = ""; 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 { $::query .= "$::comma\n "; $::comma = ","; @@ -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, # and that bug is restricted to a group, process the checkboxes that # allowed the user to set whether or not the reporter @@ -918,12 +910,6 @@ SWITCH: for ($::FORM{'knob'}) { last SWITCH; }; /^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 CheckFormField(\%::FORM, 'resolution', \@::settable_resolution); @@ -938,6 +924,11 @@ SWITCH: for ($::FORM{'knob'}) { 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'); ChangeResolution($::FORM{'resolution'}); last SWITCH; @@ -992,6 +983,9 @@ SWITCH: for ($::FORM{'knob'}) { last SWITCH; }; /^close$/ && CheckonComment( "close" ) && do { + # CLOSED bugs should have no time remaining. + _remove_remaining_time(); + ChangeStatus('CLOSED'); last SWITCH; }; @@ -1008,6 +1002,10 @@ SWITCH: for ($::FORM{'knob'}) { if (!defined($::FORM{'id'}) || $duplicate == $::FORM{'id'}) { ThrowUserError("dupe_of_self_disallowed"); } + + # DUPLICATE bugs should have no time remaining. + _remove_remaining_time(); + ChangeStatus('RESOLVED'); ChangeResolution('DUPLICATE'); $::FORM{'comment'} .= "\n\n*** This bug has been marked " . @@ -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 $delta_ts; |