if (!isset($submitted['suffix_id']) && !empty($migrationInfo['main_details']['suffix_id'])) {
$submitted['suffix_id'] = $migrationInfo['main_details']['suffix_id'];
}
-
- CRM_Contact_BAO_Contact::createProfileContact($submitted, CRM_Core_DAO::$_nullArray, $mainId);
+ $null = [];
+ CRM_Contact_BAO_Contact::createProfileContact($submitted, $null, $mainId);
}
$transaction->commit();
CRM_Utils_Hook::post('merge', 'Contact', $mainId);
public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) {
$dupePairs = self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions);
if (empty($dupePairs) && $reloadCacheIfEmpty) {
- $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions);
// If we haven't found any dupes, probably cache is empty.
// Try filling cache and give another try. We don't need to specify include conflicts here are there will not be any
// until we have done some processing.
- CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $cacheKeyString, $criteria, $checkPermissions, $searchLimit);
+ CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit);
return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions);
}
return $dupePairs;
*/
protected static function dedupePair(&$resultStats, &$deletedContacts, $mode, $checkPermissions, $mainId, $otherId, $cacheKeyString) {
- // Generate var $migrationInfo. The variable structure is exactly same as
- // $formValues submitted during a UI merge for a pair of contacts.
- $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($mainId, $otherId, $checkPermissions);
- // add additional details that we might need to resolve conflicts
- $rowsElementsAndInfo['migration_info']['main_details'] = &$rowsElementsAndInfo['main_details'];
- $rowsElementsAndInfo['migration_info']['other_details'] = &$rowsElementsAndInfo['other_details'];
- $rowsElementsAndInfo['migration_info']['rows'] = &$rowsElementsAndInfo['rows'];
- $migrationInfo = $rowsElementsAndInfo['migration_info'];
- // go ahead with merge if there is no conflict
+ $migrationInfo = [];
$conflicts = [];
if (!CRM_Dedupe_Merger::skipMerge($mainId, $otherId, $migrationInfo, $mode, $conflicts)) {
CRM_Dedupe_Merger::moveAllBelongings($mainId, $otherId, $migrationInfo, $checkPermissions);
* - Does a force merge otherwise (aggressive mode).
*
* @return array
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) {
$conflicts = [];
+ // Generate var $migrationInfo. The variable structure is exactly same as
+ // $formValues submitted during a UI merge for a pair of contacts.
+ $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($mainId, $otherId, FALSE);
+ // add additional details that we might need to resolve conflicts
+ $migrationInfo = $rowsElementsAndInfo['migration_info'];
+ $migrationInfo['main_details'] = &$rowsElementsAndInfo['main_details'];
+ $migrationInfo['other_details'] = &$rowsElementsAndInfo['other_details'];
+ $migrationInfo['rows'] = &$rowsElementsAndInfo['rows'];
+ // go ahead with merge if there is no conflict
$originalMigrationInfo = $migrationInfo;
foreach ($migrationInfo as $key => $val) {
if ($val === "null") {
}
/**
- * @param $rule_group_id
- * @param $group_id
- * @param $batchLimit
- * @param $isSelected
- * @param $includeConflicts
- * @param $criteria
- * @param $checkPermissions
+ * Get any duplicate merge pairs that have been previously cached.
+ *
+ * @param int $rule_group_id
+ * @param int $group_id
+ * @param int $batchLimit
+ * @param bool $isSelected
+ * @param bool $includeConflicts
+ * @param array $criteria
+ * @param int $checkPermissions
*
* @return array
*/