CCrmSipHelper::getDealIds

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmSipHelper
  4. getDealIds
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/sip_helper.php
  • Класс: \CCrmSipHelper
  • Вызов: CCrmSipHelper::getDealIds
static function getDealIds($entityTypeId, $entityId)
{
	$result = [];
	$filter = ['CLOSED' => 'N', 'CHECK_PERMISSIONS' => 'N'];
	switch ($entityTypeId)
	{
		case CCrmOwnerType::Contact:
			$filter['=ASSOCIATED_CONTACT_ID'] = $entityId;
			break;
		case CCrmOwnerType::Company:
			$filter['=COMPANY_ID'] = $entityId;
			break;
		default:
			throw new ArgumentException("Unsupported entity type");
	}

	$cursor = CCrmDeal::GetListEx(
		[],
		$filter,
		false,
		['nTopCount' => 1000],
		['ID']
	);

	if (is_object($cursor))
	{
		while ($deal = $cursor->Fetch())
		{
			$result[] = $deal['ID'];
		}
	}
	return $result;
}

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