From 9da04f2099ada4c481d3ff576e4a7d9004563465 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Mon, 1 Dec 2014 18:07:01 +0000 Subject: [PATCH] Avoid processing location tables when moveContactBelongings() is called without a table list since these are handled separately. Issue CRM-15658 --- CRM/Dedupe/Merger.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 7057ad3555..c1a0226b91 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -242,6 +242,20 @@ WHERE return $eidRefs; } + /** + * Return tables using locations + */ + static function locTables() { + static $locTables; + if (!$locTables) { + $locTables = array( 'civicrm_email', 'civicrm_address', 'civicrm_phone' ); + + // Allow hook_civicrm_merge() to adjust $locTables + CRM_Utils_Hook::merge('locTables', $locTables); + } + return $locTables; + } + /** * We treat multi-valued custom sets as "related tables" similar to activities, contributions, etc. * @param string $request 'relTables' or 'cidRefs' @@ -416,8 +430,9 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m } else { // if there aren't any specific tables, don't affect the ones handled by relTables() + // also don't affect tables in locTables() CRM-15658 $relTables = self::relTables(); - $handled = array(); + $handled = self::locTables(); foreach ($relTables as $params) { $handled = array_merge($handled, $params['tables']); } -- 2.25.1