* @param int $contactID
*
* @return \CRM_Event_BAO_Participant
- * @throws \CiviCRM_API3_Exception
+ * @throws \CRM_Core_Exception
*/
- protected function addParticipant(&$form, $contactID) {
- if (empty($form->_params)) {
- return NULL;
- }
- $params = $form->_params;
+ protected function addParticipant(&$form, $params, $contactID) {
$transaction = new CRM_Core_Transaction();
- // handle register date CRM-4320
- $registerDate = NULL;
- if (!empty($form->_allowConfirmation) && $form->_participantId) {
- $registerDate = $params['participant_register_date'];
- }
- elseif (!empty($params['participant_register_date']) &&
- is_array($params['participant_register_date']) &&
- !empty($params['participant_register_date'])
- ) {
- $registerDate = CRM_Utils_Date::format($params['participant_register_date']);
- }
-
$participantFields = CRM_Event_DAO_Participant::fields();
- $participantParams = array(
+ $participantParams = [
'id' => CRM_Utils_Array::value('participant_id', $params),
'contact_id' => $contactID,
'event_id' => $form->_eventId ? $form->_eventId : $params['event_id'],