- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/merger/entitymerger.php
- Класс: Bitrix\Crm\Merger\EntityMerger
- Вызов: EntityMerger::getRegisteredEntityMatches
protected function getRegisteredEntityMatches($entityTypeID, $entityID)
{
$results = array();
$existedTypeScopeMap = Integrity\DuplicateManager::getExistedTypeScopeMap(
(int)$entityTypeID,
(int)$this->userID,
$this->isAutomatic()
);
foreach($existedTypeScopeMap as $typeID => $scopes)
{
if($typeID === Integrity\DuplicateIndexType::PERSON)
{
$matches = Integrity\DuplicatePersonCriterion::getRegisteredEntityMatches($entityTypeID, $entityID);
foreach ($scopes as $scope)
$results[$typeID][$scope] = $matches;
}
elseif($typeID === Integrity\DuplicateIndexType::ORGANIZATION)
{
$matches = Integrity\DuplicateOrganizationCriterion::getRegisteredEntityMatches($entityTypeID, $entityID);
foreach ($scopes as $scope)
$results[$typeID][$scope] = $matches;
}
elseif($typeID === Integrity\DuplicateIndexType::COMMUNICATION_EMAIL
|| $typeID === Integrity\DuplicateIndexType::COMMUNICATION_PHONE)
{
$matches = Integrity\DuplicateCommunicationCriterion::getRegisteredEntityMatches(
$entityTypeID,
$entityID,
Integrity\DuplicateCommunicationCriterion::resolveTypeByIndexTypeID($typeID)
);
foreach ($scopes as $scope)
$results[$typeID][$scope] = $matches;
}
elseif(($typeID & Integrity\DuplicateIndexType::REQUISITE) === $typeID)
{
foreach ($scopes as $scope)
{
$countryId = Crm\EntityRequisite::getCountryIdByDuplicateCriterionScope($scope);
$fieldName = Integrity\DuplicateIndexType::resolveName($typeID);
$results[$typeID][$scope] = Integrity\DuplicateRequisiteCriterion::getRegisteredEntityMatches($entityTypeID, $entityID, $countryId, $fieldName);
}
}
elseif(($typeID & Integrity\DuplicateIndexType::BANK_DETAIL) === $typeID)
{
foreach ($scopes as $scope)
{
$countryId = Crm\EntityRequisite::getCountryIdByDuplicateCriterionScope($scope);
$fieldName = Integrity\DuplicateIndexType::resolveName($typeID);
$results[$typeID][$scope] = Integrity\DuplicateBankDetailCriterion::getRegisteredEntityMatches($entityTypeID, $entityID, $countryId, $fieldName);
}
}
}
return $results;
}