CCrmDealRestProxy::innerGet

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmDealRestProxy
  4. innerGet
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmDealRestProxy
  • Вызов: CCrmDealRestProxy::innerGet
protected function innerGet($ID, &$errors)
{
	$userPermissions = CCrmPerms::GetCurrentUserPermissions();
	$categoryID = CCrmDeal::GetCategoryID($ID);
	if($categoryID < 0)
	{
		$errors[] = !CCrmDeal::CheckReadPermission(0, $userPermissions) ? 'Access denied' : 'Not found';
		return false;
	}
	elseif(!CCrmDeal::CheckReadPermission($ID, CCrmPerms::GetCurrentUserPermissions(), $categoryID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$dbRes = CCrmDeal::GetListEx(
		array(),
		array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'),
		false,
		false,
		array(),
		array()
	);

	$result = $dbRes ? $dbRes->Fetch() : null;
	if(!is_array($result))
	{
		$errors[] = 'Not found';
		return false;
	}

	$userFields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields(CCrmDeal::$sUFEntityID, $ID, LANGUAGE_ID);
	foreach($userFields as $ufName => &$ufData)
	{
		$result[$ufName] = $ufData['VALUE'] ?? '';
	}
	unset($ufData);

	$result = \Bitrix\Crm\Entity\CommentsHelper::prepareFieldsFromCompatibleRestToRead(
		\CCrmOwnerType::Deal,
		$ID,
		$result,
	);

	return $result;
}

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