Ejemplo n.º 1
0
 protected function processEntityDeletion($entityTypeID, $entityID, array &$matchByType)
 {
     foreach ($matchByType as $typeID => &$typeMatches) {
         foreach ($typeMatches as &$matches) {
             $builder = Integrity\DuplicateManager::createIndexBuilder($typeID, $entityTypeID, $this->userID, $this->enablePermissionCheck);
             $builder->processEntityDeletion(Integrity\DuplicateManager::createCriterion($typeID, $matches), $entityID);
         }
         unset($matches);
     }
     unset($typeMatches);
 }
Ejemplo n.º 2
0
        __CrmDedupeListEndResonse(array('ERROR' => 'Left entity ID is not is not specified.'));
    }
    $rightEntityID = isset($_POST['RIGHT_ENTITY_ID']) ? (int) $_POST['RIGHT_ENTITY_ID'] : 0;
    if ($rightEntityID <= 0) {
        __CrmDedupeListEndResonse(array('ERROR' => 'Right entity ID is not is not specified.'));
    }
    $typeID = isset($_POST['INDEX_TYPE_NAME']) ? Integrity\DuplicateIndexType::resolveID($_POST['INDEX_TYPE_NAME']) : Integrity\DuplicateIndexType::UNDEFINED;
    if (!Integrity\DuplicateIndexType::isDefined($typeID)) {
        __CrmDedupeListEndResonse(array('ERROR' => 'Index type ID is not specified or invalid.'));
    }
    $enablePermissionCheck = !CCrmPerms::IsAdmin($currentUserID);
    $merger = Merger\EntityMerger::create($entityTypeID, $currentUserID, $enablePermissionCheck);
    $leftEntityMatches = isset($_POST['LEFT_ENTITY_INDEX_MATCHES']) && is_array($_POST['LEFT_ENTITY_INDEX_MATCHES']) ? $_POST['LEFT_ENTITY_INDEX_MATCHES'] : array();
    $leftEntityCriterion = Integrity\DuplicateManager::createCriterion($typeID, $leftEntityMatches);
    $rightEntityMatches = isset($_POST['RIGHT_ENTITY_INDEX_MATCHES']) && is_array($_POST['RIGHT_ENTITY_INDEX_MATCHES']) ? $_POST['RIGHT_ENTITY_INDEX_MATCHES'] : array();
    if (empty($rightEntityMatches)) {
        $rightEntityMatches = $leftEntityMatches;
    }
    $rightEntityCriterion = Integrity\DuplicateManager::createCriterion($typeID, $rightEntityMatches);
    try {
        $merger->registerCriterionMismatch($rightEntityCriterion, $leftEntityID, $rightEntityID);
        $builder = Integrity\DuplicateManager::createIndexBuilder($typeID, $entityTypeID, $currentUserID, $enablePermissionCheck);
        $builder->processMismatchRegistration($leftEntityCriterion, $leftEntityID);
    } catch (Merger\EntityMergerException $e) {
        __CrmDedupeListEndResonse(array('ERROR' => __CrmDedupeListErrorText($e)));
    } catch (Exception $e) {
        __CrmDedupeListEndResonse(array('ERROR' => $e->getMessage()));
    }
    $totalsText = $leftEntityCriterion->getTextTotals($leftEntityCriterion->getActualCount($entityTypeID, $leftEntityID, $currentUserID, $enablePermissionCheck, 51), 50);
    __CrmDedupeListEndResonse(array('LEFT_ENTITY_ID' => $leftEntityID, 'RIGHT_ENTITY_ID' => $rightEntityID, 'TEXT_TOTALS' => $totalsText));
}