- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integrity/duplicaterequisitecriterion.php
- Класс: Bitrix\Crm\Integrity\DuplicateRequisiteCriterion
- Вызов: DuplicateRequisiteCriterion::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', 'RQ_COUNTRY_ID', 'RQ_FIELD_NAME', 'VALUE'),
'order' => array('ID' =>'ASC'),
'filter' => array(
'ENTITY_TYPE_ID' => $entityTypeID,
'ENTITY_ID' => $entityID
)
);
if($countryId > 0)
{
$params['filter']['RQ_COUNTRY_ID'] = $countryId;
}
if($fieldName !== '')
{
$params['filter']['RQ_FIELD_NAME'] = $fieldName;
}
$dbResult = DuplicateRequisiteMatchCodeTable::getList($params);
$results = array();
while($fields = $dbResult->fetch())
{
$matches = array(
'RQ_COUNTRY_ID' => isset($fields['RQ_COUNTRY_ID']) ? $fields['RQ_COUNTRY_ID'] : '',
'RQ_FIELD_NAME' => isset($fields['RQ_FIELD_NAME']) ? $fields['RQ_FIELD_NAME'] : '',
'VALUE' => isset($fields['VALUE']) ? $fields['VALUE'] : ''
);
$results[self::prepareMatchHash($matches)] = $matches;
}
return $results;
}