'Pending from approval' => ['Registered', 'Cancelled'],
];
- /**
- */
- public function __construct() {
- parent::__construct();
- }
-
/**
* Takes an associative array and creates a participant object.
*
*
* @param array $defaults
* @param string $property
- * @param string $lookup
+ * @param string[] $lookup
* @param bool $reverse
*
* @return bool
//pull required participants, contacts, events data, if not in hand
static $eventDetails = [];
- static $domainValues = [];
static $contactDetails = [];
$contactIds = $eventIds = $participantDetails = [];
}
}
- //get the domain values.
- if (empty($domainValues)) {
- // making all tokens available to templates.
- $domain = CRM_Core_BAO_Domain::getDomain();
- $tokens = [
- 'domain' => ['name', 'phone', 'address', 'email'],
- 'contact' => CRM_Core_SelectValues::contactTokens(),
- ];
-
- foreach ($tokens['domain'] as $token) {
- $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
- }
- }
-
//get all required contacts detail.
if (!empty($contactIds)) {
- // get the contact details.
- list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
- FALSE, FALSE, NULL,
- [],
- 'CRM_Event_BAO_Participant'
- );
- foreach ($currentContactDetails as $contactId => $contactValues) {
- $contactDetails[$contactId] = $contactValues;
- }
+ $contactDetails += civicrm_api3('Contact', 'get', ['id' => ['IN' => $contactIds, 'return' => 'display_name']])['values'];
}
//get all required events detail.
$mail = self::sendTransitionParticipantMail($additionalId,
$participantDetails[$additionalId],
$eventDetails[$participantDetails[$additionalId]['event_id']],
- $contactDetails[$participantDetails[$additionalId]['contact_id']],
- $domainValues,
+ NULL,
$emailType
);
$mail = self::sendTransitionParticipantMail($participantId,
$participantValues,
$eventDetails[$participantValues['event_id']],
- $contactDetails[$participantValues['contact_id']],
- $domainValues,
+ NULL,
$emailType
);
* Required event details.
* @param array $contactDetails
* Required contact details.
- * @param array $domainValues
- * Required domain values.
* @param string $mailType
* (eg 'approval', 'confirm', 'expired' ).
*
$participantValues,
$eventDetails,
$contactDetails,
- $domainValues,
$mailType
) {
//send emails.
$receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>';
}
- list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
+ list($mailSent, $subject) = CRM_Core_BAO_MessageTemplate::sendTemplate(
[
- 'groupName' => 'msg_tpl_workflow_event',
- 'valueName' => 'participant_' . strtolower($mailType),
+ 'workflow' => 'participant_' . strtolower($mailType),
'contactId' => $contactId,
+ 'tokenContext' => ['participantId' => $participantId],
'tplParams' => [
- 'contact' => $contactDetails,
- 'domain' => $domainValues,
'participant' => $participantValues,
'event' => $eventDetails,
'paidEvent' => $eventDetails['is_monetary'] ?? NULL,
'isShowLocation' => $eventDetails['is_show_location'] ?? NULL,
'isAdditional' => $participantValues['registered_by_id'],
- 'isExpired' => $mailType == 'Expired',
- 'isConfirm' => $mailType == 'Confirm',
+ 'isExpired' => $mailType === 'Expired',
+ 'isConfirm' => $mailType === 'Confirm',
'checksumValue' => $checksumValue,
],
'from' => $receiptFrom,
*
* @return string
*/
- public function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
+ public static function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
$statusMsg = NULL;
$results = self::transitionParticipants([$participantId],
$statusChangeTo, $fromStatusId, TRUE
* @param int $newStatusId
* New status.
*
- * @return bool
- * true if allowed
+ * @return array
*/
public static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId) {