Livefeed::addComment

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Livefeed
  4. addComment
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/livefeed.php
  • Класс: Bitrix\Crm\Activity\Provider\Livefeed
  • Вызов: Livefeed::addComment
static function addComment($comment, $log)
{
	$res = \CCrmActivity::getList(
		array(),
		array(
			'=PROVIDER_ID' => self::PROVIDER_ID,
			'=PROVIDER_TYPE_ID' => self::PROVIDER_TYPE_ID_ENTRY,
			'=ASSOCIATED_ENTITY_ID' => $log['ID'],
			'CHECK_PERMISSIONS' => 'N'
		),
		false,
		false,
		array('ID', 'COMMUNICATIONS')
	);

	if ($parentActivity = $res->fetch())
	{
		$fields = array(
			"TYPE" => "COMMENT_OUT",
			"COMMUNICATIONS" => $parentActivity['COMMUNICATIONS'],
			"BINDINGS" => \CCrmActivity::getBindings($parentActivity['ID']),
			"MESSAGE" => $comment['MESSAGE'],
			"USER_ID" => $comment['USER_ID'],
			"RESPONSIBLE_USER_ID" => $log['USER_ID'],
			"ENTITY_ID" => $comment["ID"],
			"PARENT_ID" => $parentActivity['ID']
		);

		$res = \Bitrix\Main\UserTable::getList(array(
			'filter' => array("=ID" => $comment['USER_ID']),
			'select' => array("EXTERNAL_AUTH_ID")
		));

		if (
			($user = $res->fetch())
			&& ($user["EXTERNAL_AUTH_ID"] == 'email')
		)
		{
			$fields["TYPE"] = "COMMENT_IN";
		}

		self::addActivity($fields);
	}
}

Добавить комментарий