Skip to content
Snippets Groups Projects
Commit 55033e60 authored by pratik.joshi's avatar pratik.joshi
Browse files

CRM-12726 : applied patch and did some modifications

parent e98157df
No related branches found
No related tags found
No related merge requests found
......@@ -772,19 +772,31 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
$logDAO->entity_table = 'civicrm_contact';
$logDAO->entity_id = $id;
$logDAO->delete();
// delete contact participants CRM-12155
CRM_Event_BAO_Participant::deleteContactParticipant($id);
// delete contact contributions CRM-12155
CRM_Contribute_BAO_Contribution::deleteContactContribution($id);
// do activity cleanup, CRM-5604
CRM_Activity_BAO_Activity::cleanupActivity($id);
// delete all notes related to contact
CRM_Core_BAO_Note::cleanContactNotes($id);
// delete cases related to contact
$contactCases = CRM_Case_BAO_Case::retrieveCaseIdsByContactId($id);
if (!empty($contactCases)) {
foreach($contactCases as $caseId){
//check if case is associate with other contact or not.
$caseContactId = CRM_Case_BAO_Case::getCaseClients($caseId);
if(count($caseContactId) <= 1){
CRM_Case_BAO_Case::deleteCase($caseId);
}
}
}
$contact->delete();
}
else {
......
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