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

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

	$query = new Main\Entity\Query(DuplicateBankDetailMatchCodeTable::getEntity());
	$query->addFilter('=ENTITY_TYPE_ID', $entityTypeID);
	$query->addFilter('=ENTITY_ID', $entityID);
	if ($countryId > 0)
		$query->addFilter('=BD_COUNTRY_ID', $countryId);
	$query->addFilter('=BD_FIELD_NAME', $fieldName);

	$query->addSelect('VALUE');
	$query->addSelect('BD_COUNTRY_ID');

	$dbResult = $query->exec();
	$results = array();
	while($fields = $dbResult->fetch())
	{
		$results[] = array(
			'BD_COUNTRY_ID' => $fields['BD_COUNTRY_ID'],
			'BD_FIELD_NAME' => $fieldName,
			'VALUE' => isset($fields['VALUE']) ? $fields['VALUE'] : ''
		);
	}
	return $results;
}