• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
  • Класс: BitrixTasksControlTask
  • Вызов: Task::postUpdateComments
private function postUpdateComments(array $fields)
{
	$updateComment = false;
	if ($this->skipComments)
	{
		return $updateComment;
	}

	$fieldsForComments = ['STATUS', 'CREATED_BY', 'RESPONSIBLE_ID', 'ACCOMPLICES', 'AUDITORS', 'DEADLINE', 'GROUP_ID'];
	$changesForUpdate = array_intersect_key($this->changes, array_flip($fieldsForComments));

	if (empty($changesForUpdate))
	{
		return $updateComment;
	}

	$commentPoster = CommentPoster::getInstance($this->taskId, $this->getOccurUserId());
	if ($commentPoster)
	{
		if (!($isDeferred = $commentPoster->getDeferredPostMode()))
		{
			$commentPoster->enableDeferredPostMode();
		}

		$commentPoster->postCommentsOnTaskUpdate($this->sourceTaskData, $fields, $changesForUpdate);
		$updateComment =
			$commentPoster->getCommentByType(Comment::TYPE_UPDATE)
			|| $commentPoster->getCommentByType(Comment::TYPE_STATUS);

		if (!$isDeferred)
		{
			$commentPoster->disableDeferredPostMode();
			$commentPoster->postComments();
			$commentPoster->clearComments();
		}
	}

	return $updateComment;
}