}
}
- $mainCase->free();
-
$mainCaseIds[] = $mainCaseId;
//insert record for case contact.
$otherCaseContact = new CRM_Case_DAO_CaseContact();
if (!$mainCaseContact->find(TRUE)) {
$mainCaseContact->save();
}
- $mainCaseContact->free();
}
- $otherCaseContact->free();
}
elseif (!$otherContactId) {
$otherContactId = $mainContactId;
// insert log of all activities
CRM_Activity_BAO_Activity::logActivityAction($mainActivity);
- $otherActivity->free();
- $mainActivity->free();
$copiedActivityIds[] = $otherActivityId;
//create case activity record.
$mainCaseActivity->case_id = $mainCaseId;
$mainCaseActivity->activity_id = $mainActivityId;
$mainCaseActivity->save();
- $mainCaseActivity->free();
//migrate source activity.
$otherSourceActivity = new CRM_Activity_DAO_ActivityContact();
if (!$mainActivitySource->find(TRUE)) {
$mainActivitySource->save();
}
- $mainActivitySource->free();
}
- $otherSourceActivity->free();
//migrate target activities.
$otherTargetActivity = new CRM_Activity_DAO_ActivityContact();
if (!$mainActivityTarget->find(TRUE)) {
$mainActivityTarget->save();
}
- $mainActivityTarget->free();
}
- $otherTargetActivity->free();
//migrate assignee activities.
$otherAssigneeActivity = new CRM_Activity_DAO_ActivityContact();
if (!$mainAssigneeActivity->find(TRUE)) {
$mainAssigneeActivity->save();
}
- $mainAssigneeActivity->free();
}
- $otherAssigneeActivity->free();
// copy custom fields and attachments
$aparams = array(
if (!$mainRelationship->find(TRUE)) {
$mainRelationship->save();
}
- $mainRelationship->free();
//get the other relationship ids to update end date.
if ($updateOtherRel) {
$otherRelationshipIds[$otherRelationship->id] = $otherRelationship->id;
}
}
- $otherRelationship->free();
//update other relationships end dates
if (!empty($otherRelationshipIds)) {
if (!$mergeActivityId) {
continue;
}
- $mergeActivity->free();
//connect merge activity to case.
$mergeCaseAct = array(
if (!$newRelationship->find(TRUE)) {
$newRelationship->save();
}
- $newRelationship->free();
// store relationship type of newly created relationship
$relationshipTypes[] = $caseRelationships->relationship_type_id;