Skip to content

Commit

Permalink
Replace call to getTokenDetails with simple contact.get
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Oct 19, 2021
1 parent 236e18e commit d171f73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CRM/Event/BAO/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,12 @@ public static function sendTransitionParticipantMail(
//send emails.
$mailSent = FALSE;

if (!$contactDetails) {
$contactDetails = civicrm_api3('Contact', 'getsingle', [
'id' => $participantValues['contact_id'],
'return' => ['email', 'display_name'],
]);
}
//don't send confirmation mail to additional
//since only primary able to confirm registration.
if (!empty($participantValues['registered_by_id']) &&
Expand Down
16 changes: 3 additions & 13 deletions CRM/Event/Form/SelfSvcTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,23 +458,13 @@ public function sendCancellation() {
//get the location info
$locParams = ['entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event'];
$eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
//get contact details
$contactIds[$this->_from_contact_id] = $this->_from_contact_id;
list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
FALSE, FALSE, NULL, [],
'CRM_Event_BAO_Participant'
);
foreach ($currentContactDetails as $contactId => $contactValues) {
$contactDetails[$this->_from_contact_id] = $contactValues;
}
//send a 'cancelled' email to user, and cc the event's cc_confirm email
$mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_from_participant_id,
CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_from_participant_id,
$participantDetails[$this->_from_participant_id],
$eventDetails[$this->_event_id],
$contactDetails[$this->_from_contact_id],
NULL,
$domainValues,
"Transferred",
""
'Transferred'
);
$statusMsg = ts('Event registration information for %1 has been updated.', [1 => $this->_contact_name]);
$statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', [1 => $this->_contact_email]);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public function paymentProcessorAuthorizeNetCreate($params = []) {
*/
public function participantCreate(array $params = []) {
if (empty($params['contact_id'])) {
$params['contact_id'] = $this->individualCreate();
$this->ids['Contact']['participant'] = $params['contact_id'] = $this->individualCreate();
}
if (empty($params['event_id'])) {
$event = $this->eventCreate();
Expand Down

0 comments on commit d171f73

Please sign in to comment.