• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/duplicatebankdetailcriterion.php
  • Класс: Bitrix\Crm\Integrity\DuplicateBankDetailCriterion
  • Вызов: DuplicateBankDetailCriterion::getRegisteredEntityMatches
static function getRegisteredEntityMatches($entityTypeID, $entityID, $countryId = 0, $fieldName = '')
{
	if(!is_int($entityTypeID))
	{
		throw new Main\ArgumentTypeException('entityTypeID', 'integer');
	}

	if(!is_int($entityID))
	{
		throw new Main\ArgumentTypeException('entityID', 'integer');
	}

	if(!is_int($countryId))
	{
		throw new Main\ArgumentTypeException('countryId', 'integer');
	}

	if(!is_string($fieldName))
	{
		throw new Main\ArgumentTypeException('fieldName', 'string');
	}

	$params = array(
		'select' =>array('ID', 'BD_COUNTRY_ID', 'BD_FIELD_NAME', 'VALUE'),
		'order' => array('ID' =>'ASC'),
		'filter' =>  array(
			'ENTITY_TYPE_ID' => $entityTypeID,
			'ENTITY_ID' => $entityID
		)
	);

	if($countryId > 0)
	{
		$params['filter']['BD_COUNTRY_ID'] = $countryId;
	}

	if($fieldName !== '')
	{
		$params['filter']['BD_FIELD_NAME'] = $fieldName;
	}

	$dbResult = DuplicateBankDetailMatchCodeTable::getList($params);
	$results = array();
	while($fields = $dbResult->fetch())
	{
		$matches = array(
			'BD_COUNTRY_ID' => isset($fields['BD_COUNTRY_ID']) ? $fields['BD_COUNTRY_ID'] : '',
			'BD_FIELD_NAME' => isset($fields['BD_FIELD_NAME']) ? $fields['BD_FIELD_NAME'] : '',
			'VALUE' => isset($fields['VALUE']) ? $fields['VALUE'] : ''
		);
		$results[self::prepareMatchHash($matches)] = $matches;
	}
	return $results;
}