From d78689415035a705eebddec26b48591b9c68c742 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 14 Jul 2010 00:47:21 +0200 Subject: 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 --- Bugzilla/Bug.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index e28c752df..fce2a1634 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; @@ -2627,7 +2627,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. -- cgit v1.2.3-24-g4f1b