continue;
}
+ if ($table === 'civicrm_activity_contact') {
+ $sqls[] = "UPDATE IGNORE civicrm_activity_contact SET contact_id = $mainId WHERE contact_id = $otherId";
+ $sqls[] = "DELETE FROM civicrm_activity_contact WHERE contact_id = $otherId";
+ continue;
+ }
+
// use UPDATE IGNORE + DELETE query pair to skip on situations when
// there's a UNIQUE restriction on ($field, some_other_field) pair
if (isset($cidRefs[$table])) {
$this->callAPISuccess('Job', 'process_batch_merge', ['mode' => 'safe']);
}
+ /**
+ * Test that we handle cache entries without clashes.
+ */
+ public function testMergeSharedActivity() {
+ $contactID = $this->individualCreate();
+ $contact2ID = $this->individualCreate();
+ $activityID = $this->activityCreate(['target_contact_id' => [$contactID, $contact2ID]]);
+ $this->callAPISuccess('Job', 'process_batch_merge', ['mode' => 'safe']);
+ }
+
/**
* Test the decisions made for addresses when merging.
*