From d41da7271b27b4fa278fdc6af4abc7c27e5e1b55 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 21 Mar 2019 11:32:02 -0400 Subject: [PATCH] BAO_Participant - Use default status if not specified for create --- CRM/Event/BAO/Participant.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); } -- 2.25.1