From: Frédéric Buclin Date: Tue, 13 Jul 2010 22:49:35 +0000 (+0200) Subject: Bug 578324: The "Hours Worked" field in show_bug.cgi rejects all values passed to... X-Git-Tag: bugzilla-3.7.3~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1316d882733ae7f76e209640dee4c7ffa4204dfa;p=thirdparty%2Fbugzilla.git Bug 578324: The "Hours Worked" field in show_bug.cgi rejects all values passed to it if it would make the Remaining Time negative r/a=mkanat --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index ecd00ff019..3c7eb3d5c2 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -50,7 +50,7 @@ use Bugzilla::Status; use Bugzilla::Comment; use List::MoreUtils qw(firstidx uniq); -use List::Util qw(min first); +use List::Util qw(min max first); use Storable qw(dclone); use URI; use URI::QueryParam; @@ -2628,7 +2628,7 @@ sub add_comment { # later in set_all. But if they haven't, this keeps remaining_time # up-to-date. if ($params->{work_time}) { - $self->set_remaining_time($self->remaining_time - $params->{work_time}); + $self->set_remaining_time(max($self->remaining_time - $params->{work_time}, 0)); } # So we really want to comment. Make sure we are allowed to do so.