Merge pull request #16438 from eileenmcnaughton/ev_clean
authorcolemanw <coleman@civicrm.org>
Fri, 31 Jan 2020 22:32:45 +0000 (17:32 -0500)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2020 22:32:45 +0000 (17:32 -0500)
[REF] Pass params into function rather than this weird check for whether params exists.

1  2 
CRM/Event/Form/Participant.php

index d12d0a9d6e79ac046fee53d56e672018723310a0,bc650a2ace143e7a8a3dfb12aea68a499623caf5..ff13614c0668e3c8b6512805a41c63e60a6b52de
@@@ -2081,17 -2097,25 +2097,13 @@@ class CRM_Event_Form_Participant extend
     * @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'],