$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);
$errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", array(1 => $contributionStatuses[$values['contribution_status_id']], 2 => $contributionStatuses[$fields['contribution_status_id']]));
}
}
+
+ /**
+ * Function to delete contribution of contact
+ *
+ * CRM-12155
+ *
+ * @param integer $contactId contact id
+ *
+ * @access public
+ * @static
+ */
+ static function deleteContactContribution($contactId) {
+ $contribution = new CRM_Contribute_DAO_Contribution();
+ $contribution->contact_id = $contactId;
+ $contribution->find();
+ while ($contribution->fetch()) {
+ self::deleteContribution($contribution->id);
+ }
+ }
}
}
return;
}
+
+ /**
+ * Function to delete participants of contact
+ *
+ * CRM-12155
+ *
+ * @param integer $contactId contact id
+ *
+ * @access public
+ * @static
+ */
+ static function deleteContactParticipant($contactId) {
+ $participant = new CRM_Event_DAO_Participant();
+ $participant->contact_id = $contactId;
+ $participant->find();
+ while ($participant->fetch()) {
+ self::deleteParticipant($participant->id);
+ }
+ }
}