'status_id' => CRM_Utils_Array::value('participant_status',
$params, 1
),
- 'role_id' => CRM_Utils_Array::value('participant_role_id', $params) ?: self::getDefaultRoleID(),
+ 'role_id' => CRM_Utils_Array::value('participant_role_id', $params) ?: CRM_Event_BAO_Participant::getDefaultRoleID(),
'register_date' => ($registerDate) ? $registerDate : date('YmdHis'),
'source' => CRM_Utils_String::ellipsify(
isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params),
return $participant;
}
- /**
- * Get the ID of the default (first) participant role
- *
- * @return int
- * @throws \CiviCRM_API3_Exception
- */
- private static function getDefaultRoleID() {
- return (int) civicrm_api3('OptionValue', 'getvalue', [
- 'return' => "value",
- 'option_group_id' => "participant_role",
- 'is_active' => 1,
- 'options' => ['limit' => 1, 'sort' => "is_default DESC"],
- ]);
- }
-
/**
* Calculate the total participant count as per params.
*