/** * Delete the record that are associated with this Participation Payment * * @param array $params array in the format of $field => $value. * * @return boolean true if deleted false otherwise * @access public */ static function deleteParticipantPayment($params) { require_once 'CRM/Event/DAO/ParticipantPayment.php'; $participantPayment = new CRM_Event_DAO_ParticipantPayment(); $valid = false; foreach ($params as $field => $value) { if (!empty($value)) { $participantPayment->{$field} = $value; $valid = true; } } if (!$valid) { CRM_Core_Error::fatal(); } if ($participantPayment->find(true)) { require_once 'CRM/Contribute/BAO/Contribution.php'; CRM_Contribute_BAO_Contribution::deleteContribution($participantPayment->contribution_id); $participantPayment->delete(); return $participantPayment; } return false; }
/** * Delete the record that are associated with this ParticipantPayment. * Also deletes the associated contribution for this participant * * @param array $params * Associative array whose values match the record to be deleted. * * @return bool * true if deleted false otherwise */ public static function deleteParticipantPayment($params) { $participantPayment = new CRM_Event_DAO_ParticipantPayment(); $valid = FALSE; foreach ($params as $field => $value) { if (!empty($value)) { $participantPayment->{$field} = $value; $valid = TRUE; } } if (!$valid) { CRM_Core_Error::fatal(); } if ($participantPayment->find(TRUE)) { CRM_Utils_Hook::pre('delete', 'ParticipantPayment', $participantPayment->id, $params); CRM_Contribute_BAO_Contribution::deleteContribution($participantPayment->contribution_id); $participantPayment->delete(); CRM_Utils_Hook::post('delete', 'ParticipantPayment', $participantPayment->id, $participantPayment); return $participantPayment; } return FALSE; }