CCrmDealRecurringRestProxy::expose

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmDealRecurringRestProxy
  4. expose
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmDealRecurringRestProxy
  • Вызов: CCrmDealRecurringRestProxy::expose
public function expose($ID)
{
	$ID = (int)$ID;
	if(!$this->checkEntityID($ID))
	{
		throw new RestException('ID is not defined or invalid.');
	}

	$errors = array();
	$fields = $this->innerGet($ID, $errors);
	if(!is_array($fields))
	{
		throw new RestException(implode("\n", $errors));
	}

	$categoryId = -1;
	if ((int)$fields['CATEGORY_ID'] >= 0)
	{
		$categoryId = (int)$fields['CATEGORY_ID'];
	}

	$userPermissions = CCrmPerms::GetCurrentUserPermissions();
	if (
		!CCrmDeal::CheckReadPermission($fields['DEAL_ID'], $userPermissions)
		|| !CCrmDeal::CheckCreatePermission($userPermissions, $categoryId)
	)
	{
		throw new RestException(implode("\n", ['Access denied.']));
	}

	$dealRecurring = \Bitrix\Crm\Recurring\Entity\Deal::getInstance();
	$result = $dealRecurring->expose(['=ID' => $ID], 1, false);
	if (!$result->isSuccess())
	{
		throw new RestException(implode("\n", $result->getErrorMessages()));
	}

	$exposeData = $result->getData();
	return ['DEAL_ID' => $exposeData['ID'][0]];
}

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