copyValues($params); if (isset($ids['id'])) { $participantPayment->id = CRM_Utils_Array::value('id', $ids); } else { $participantPayment->find(TRUE); } $participantPayment->save(); if (isset($ids['id'])) { CRM_Utils_Hook::post('edit', 'ParticipantPayment', $ids['id'], $participantPayment); } else { CRM_Utils_Hook::post('create', 'ParticipantPayment', NULL, $participantPayment); } return $participantPayment; } /** * 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 boolean true if deleted false otherwise * @static * @access 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; } }