$arResult['LIST_ID'] = $listID; $arResult['ERRORS'] = array(); $arResult['MESSAGES'] = array(); $entityTypeID = isset($arParams['ENTITY_TYPE_ID']) ? intval($arParams['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined; if ($entityTypeID === CCrmOwnerType::Undefined && isset($arParams['ENTITY_TYPE'])) { $entityTypeID = CCrmOwnerType::ResolveID($arParams['ENTITY_TYPE']); } if ($entityTypeID !== CCrmOwnerType::Contact && $entityTypeID !== CCrmOwnerType::Company && $entityTypeID !== CCrmOwnerType::Lead) { ShowError(GetMessage('CRM_DEDUPE_LIST_INVALID_ENTITY_TYPE', array('#TYPE_NAME#' => CCrmOwnerType::ResolveName($entityTypeID)))); return; } $arResult['ENTITY_TYPE_ID'] = $entityTypeID; $entityTypeName = $arResult['ENTITY_TYPE_NAME'] = \CCrmOwnerType::ResolveName($entityTypeID); //TYPE INDEX INFO $typeInfos = array(); $indexedTypes = $arResult['TYPES'] = Integrity\DuplicateIndexBuilder::getExistedTypes($entityTypeID, $userID); $supportedTypes = $arResult['SUPPORTED_TYPES'] = Integrity\DuplicateIndexType::getSupportedTypes($entityTypeID); $typeDescriptions = $arResult['TYPE_DESCRIPTIONS'] = Integrity\DuplicateIndexType::getAllDescriptions(); $selectedTypes = array(); $filterTypeID = isset($_GET['typeId']) ? (int) $_GET['typeId'] : Integrity\DuplicateIndexType::UNDEFINED; $skippedTypeIDs = array(); foreach ($supportedTypes as $typeID) { $typeLayoutID = CCrmOwnerType::Undefined; if ($typeID === Integrity\DuplicateIndexType::ORGANIZATION) { $typeLayoutID = CCrmOwnerType::Company; } elseif ($typeID === Integrity\DuplicateIndexType::PERSON) { $typeLayoutID = CCrmOwnerType::Contact; } $groupName = ''; if ($typeID === Integrity\DuplicateIndexType::PERSON || $typeID === Integrity\DuplicateIndexType::ORGANIZATION) { $groupName = 'denomination';
protected function getRegisteredEntityMatches($entityTypeID, $entityID) { $results = array(); $types = Integrity\DuplicateIndexBuilder::getExistedTypes($entityTypeID, $this->userID); foreach ($types as $typeID) { if ($typeID === Integrity\DuplicateIndexType::PERSON) { $results[$typeID] = Integrity\DuplicatePersonCriterion::getRegisteredEntityMatches($entityTypeID, $entityID); } elseif ($typeID === Integrity\DuplicateIndexType::ORGANIZATION) { $results[$typeID] = Integrity\DuplicateOrganizationCriterion::getRegisteredEntityMatches($entityTypeID, $entityID); } elseif ($typeID === Integrity\DuplicateIndexType::COMMUNICATION_EMAIL || $typeID === Integrity\DuplicateIndexType::COMMUNICATION_PHONE) { $results[$typeID] = Integrity\DuplicateCommunicationCriterion::getRegisteredEntityMatches($entityTypeID, $entityID, Integrity\DuplicateCommunicationCriterion::resolveTypeByIndexTypeID($typeID)); } } return $results; }