diff options
author | travis%sedsystems.ca <> | 2005-02-17 01:16:35 +0100 |
---|---|---|
committer | travis%sedsystems.ca <> | 2005-02-17 01:16:35 +0100 |
commit | ea7030a701bfdb503df542c3d7e814b8ea702929 (patch) | |
tree | 8ae843e12c0e186587cc1e440090b12f7e3c943e /globals.pl | |
parent | 4f8be6528de20edd9a5eaa599b11a95a50382918 (diff) | |
download | bugzilla-ea7030a701bfdb503df542c3d7e814b8ea702929.tar.gz bugzilla-ea7030a701bfdb503df542c3d7e814b8ea702929.tar.xz |
Bug 271276 : Cannot enter negative time for 'Hours Worked'
Patch by Shane H. W. Travis <travis@sedsystems.ca> r=LpSolit a=justdave
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/globals.pl b/globals.pl index 0b7d23bc2..1bd53261f 100644 --- a/globals.pl +++ b/globals.pl @@ -109,23 +109,19 @@ $::SIG{PIPE} = 'IGNORE'; sub AppendComment { my ($bugid, $who, $comment, $isprivate, $timestamp, $work_time) = @_; $work_time ||= 0; - + + if ($work_time) { + require Bugzilla::Bug; + Bugzilla::Bug::ValidateTime($work_time, "work_time"); + } + # Use the date/time we were given if possible (allowing calling code # to synchronize the comment's timestamp with those of other records). $timestamp = ($timestamp ? SqlQuote($timestamp) : "NOW()"); - + $comment =~ s/\r\n/\n/g; # Get rid of windows-style line endings. $comment =~ s/\r/\n/g; # Get rid of mac-style line endings. - # allowing negatives though so people can back out errors in time reporting - if (defined $work_time) { - # regexp verifies one or more digits, optionally followed by a period and - # zero or more digits, OR we have a period followed by one or more digits - if ($work_time !~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { - ThrowUserError("need_numeric_value", {}, "abort"); - } - } else { $work_time = 0 }; - if ($comment =~ /^\s*$/) { # Nothin' but whitespace return; } |