From: Coleman Watts Date: Thu, 21 Mar 2019 15:32:02 +0000 (-0400) Subject: BAO_Participant - Use default status if not specified for create X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d41da7271b27b4fa278fdc6af4abc7c27e5e1b55;p=civicrm-core.git BAO_Participant - Use default status if not specified for create --- diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 889f88b4a4..a58eafc6eb 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -136,8 +136,6 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { $participantBAO->save(); - $session = CRM_Core_Session::singleton(); - CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush(); if (!empty($params['id'])) { @@ -203,9 +201,12 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { return $participant; } - if ((!CRM_Utils_Array::value('id', $params)) || + // Log activity when creating new participant or changing status + if (empty($params['id']) || (isset($params['status_id']) && $params['status_id'] != $status) ) { + // Default status if not specified + $participant->status_id = $participant->status_id ?: self::fields()['participant_status_id']['default']; CRM_Activity_BAO_Activity::addActivity($participant); }