]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 686963: Setting the work time using the Bug.update WebService method
authorTiago Mello <timello@gmail.com>
Wed, 19 Oct 2011 03:06:04 +0000 (01:06 -0200)
committerTiago Mello <timello@gmail.com>
Wed, 19 Oct 2011 03:06:04 +0000 (01:06 -0200)
requires a comment.
r/a=LpSolit

Bugzilla/Bug.pm

index 175bcd050060017db1b4155960340b161f78d526..515fabb90dcb6d0bda963c25a3d2856563afbf3e 100644 (file)
@@ -2677,20 +2677,22 @@ sub add_comment {
 
     $params ||= {};
 
-    # This makes it so we won't create new comments when there is nothing
-    # to add 
-    if ($comment eq '' && !($params->{type} || abs($params->{work_time} || 0))) {
-        return;
-    }
-
     # Fill out info that doesn't change and callers may not pass in
     $params->{'bug_id'}  = $self;
-    $params->{'thetext'} = $comment;
+    $params->{'thetext'} = defined($comment) ? $comment : '';
 
     # Validate all the entered data
     Bugzilla::Comment->check_required_create_fields($params);
     $params = Bugzilla::Comment->run_create_validators($params);
 
+    # This makes it so we won't create new comments when there is nothing
+    # to add 
+    if ($params->{'thetext'} eq ''
+        && !($params->{type} || abs($params->{work_time} || 0)))
+    {
+        return;
+    }
+
     # If the user has explicitly set remaining_time, this will be overridden
     # later in set_all. But if they haven't, this keeps remaining_time
     # up-to-date.