• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/recycling/invoicebinder.php
  • Класс: Bitrix\Crm\Recycling\InvoiceBinder
  • Вызов: InvoiceBinder::getBoundEntityIDs
public function getBoundEntityIDs($associatedEntityTypeID, $associatedEntityID)
{
	if($associatedEntityTypeID === \CCrmOwnerType::Contact)
	{
		$fieldName = 'UF_CONTACT_ID';
	}
	else if($associatedEntityTypeID === \CCrmOwnerType::Company)
	{
		$fieldName = 'UF_COMPANY_ID';
	}
	else if($associatedEntityTypeID === \CCrmOwnerType::Deal)
	{
		$fieldName = 'UF_DEAL_ID';
	}
	else
	{
		$entityTypeName = \CCrmOwnerType::ResolveName($associatedEntityTypeID);
		throw new Main\NotSupportedException("Entity '{$entityTypeName}' not supported in current context.");
	}

	$dbResult = \CCrmInvoice::GetList(
		array(),
		array("={$fieldName}" => $associatedEntityID, 'CHECK_PERMISSIONS' => 'N'),
		false,
		false,
		array('ID')
	);

	$results = array();
	while($fields = $dbResult->Fetch())
	{
		$results[] = (int)$fields['ID'];
	}
	return $results;
}