• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/commentitem.php
  • Класс: CTaskCommentItem
  • Вызов: CTaskCommentItem::update
public function update($fields): bool
{
	if (!is_array($fields))
	{
		$fields = [];
	}

	// Nothing to do?
	if (empty($fields))
	{
		return false;
	}

	// rights are checked inside forum`s taskEntity class, NO NEED to check rights
	// but for compatibility reasons, we have to leave exception throw here
	if (!$this->isActionAllowed(self::ACTION_COMMENT_MODIFY))
	{
		throw new TasksException('Action is not allowed', TasksException::TE_ACTION_NOT_ALLOWED);
	}

	$fields = self::formatPostDateField($fields);
	$result = Comment::update($this->itemId, $fields, $this->taskId);

	if (!$result->isSuccess())
	{
		$errorMessages = ($result->getErrors() ? $result->getErrors()->getMessages() : ['']);
		$errorCode = TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED | TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE;

		throw new TasksException(serialize($errorMessages), $errorCode);
	}

	return true;
}