Skip to content
Snippets Groups Projects
Unverified Commit 2c409890 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #14142 from eileenmcnaughton/dedupe2

 [REF] move gathering of location info to relevant function (towards #723)
parents 46be876e 35e0e03e
No related branches found
No related tags found
No related merge requests found
...@@ -1610,7 +1610,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m ...@@ -1610,7 +1610,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
} }
$relTables = CRM_Dedupe_Merger::relTables(); $relTables = CRM_Dedupe_Merger::relTables();
$submittedCustomFields = $moveTables = $locationMigrationInfo = $tableOperations = $removeTables = []; $submittedCustomFields = $moveTables = $tableOperations = $removeTables = [];
self::swapOutFieldsAffectedByQFZeroBug($migrationInfo); self::swapOutFieldsAffectedByQFZeroBug($migrationInfo);
foreach ($migrationInfo as $key => $value) { foreach ($migrationInfo as $key => $value) {
...@@ -1622,10 +1622,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m ...@@ -1622,10 +1622,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
elseif (in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) && $value != NULL) { elseif (in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) && $value != NULL) {
$submitted[substr($key, 5)] = $value; $submitted[substr($key, 5)] = $value;
} }
// Set up initial information for handling migration of location blocks
elseif (substr($key, 0, 14) == 'move_location_' and $value != NULL) {
$locationMigrationInfo[$key] = $value;
}
elseif (substr($key, 0, 15) == 'move_rel_table_' and $value == '1') { elseif (substr($key, 0, 15) == 'move_rel_table_' and $value == '1') {
$moveTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']); $moveTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']);
if (array_key_exists('operation', $migrationInfo)) { if (array_key_exists('operation', $migrationInfo)) {
...@@ -1640,7 +1636,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m ...@@ -1640,7 +1636,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
$removeTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']); $removeTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']);
} }
} }
self::mergeLocations($mainId, $otherId, $locationMigrationInfo, $migrationInfo); self::mergeLocations($mainId, $otherId, $migrationInfo);
// **** Do contact related migrations // **** Do contact related migrations
$customTablesToCopyValues = self::getAffectedCustomTables($submittedCustomFields); $customTablesToCopyValues = self::getAffectedCustomTables($submittedCustomFields);
...@@ -2231,14 +2227,16 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m ...@@ -2231,14 +2227,16 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
* *
* @param int $mainId * @param int $mainId
* @param int $otherId * @param int $otherId
* @param array $locationMigrationInfo
* Portion of the migration_info that holds location migration information.
* *
* @param array $migrationInfo * @param array $migrationInfo
* Migration info for the merge. This is passed to the hook as informational only. * Migration info for the merge. This is passed to the hook as informational only.
*/ */
public static function mergeLocations($mainId, $otherId, $locationMigrationInfo, $migrationInfo) { public static function mergeLocations($mainId, $otherId, $migrationInfo) {
foreach ($locationMigrationInfo as $key => $value) { foreach ($migrationInfo as $key => $value) {
$isLocationField = (substr($key, 0, 14) == 'move_location_' and $value != NULL);
if (!$isLocationField) {
continue;
}
$locField = explode('_', $key); $locField = explode('_', $key);
$fieldName = $locField[2]; $fieldName = $locField[2];
$fieldCount = $locField[3]; $fieldCount = $locField[3];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment