CCrmTimelineCommentRestProxy::innerGet

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmTimelineCommentRestProxy
  4. innerGet
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmTimelineCommentRestProxy
  • Вызов: CCrmTimelineCommentRestProxy::innerGet
protected function innerGet($ID, &$errors)
{
	$entityId =
	$entityTypeId = null;

	$commentRaw = \Bitrix\Crm\Timeline\Entity\TimelineTable::getById($ID);
	if (!($comment = $commentRaw->fetch()))
	{
		$errors[] = 'Not found.';
		return false;
	}

	$bindingsDataRaw = \Bitrix\Crm\Timeline\Entity\TimelineBindingTable::getList([
		'filter' => ['OWNER_ID' => $ID]
	]);

	while ($binding = $bindingsDataRaw->fetch())
	{
		if (Bitrix\Crm\Security\EntityAuthorization::checkReadPermission($binding['ENTITY_TYPE_ID'], $binding['ENTITY_ID']))
		{
			$entityId = $binding['ENTITY_ID'];
			$entityTypeId = $binding['ENTITY_TYPE_ID'];
			break;
		}
	}

	if (empty($entityId))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$comment['ENTITY_ID'] = $entityId;
	$comment['ENTITY_TYPE'] = mb_strtolower(CCrmOwnerType::ResolveName($entityTypeId));

	return $this->prepareGetResult($comment);
}

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