Merge pull request #15817 from colemanw/Fix
[civicrm-core.git] / CRM / Event / Form / SelfSvcTransfer.php
CommitLineData
97d8187a
DG
1<?php
2
3/*
4 +--------------------------------------------------------------------+
bc77d7c0 5 | Copyright CiviCRM LLC. All rights reserved. |
97d8187a 6 | |
bc77d7c0
TO
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
97d8187a
DG
10 +--------------------------------------------------------------------+
11 */
12
13/**
14 *
15 * @package CRM
ca5cec67 16 * @copyright CiviCRM LLC https://civicrm.org/licensing
97d8187a
DG
17 * $Id$
18 *
19 */
20
21/**
22 * This class generates form components to transfer an Event to another participant
23 *
24 */
25class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
26 /**
27 * from particpant id
28 *
29 * @var string
30 *
31 */
32 protected $_from_participant_id;
33 /**
34 * from contact id
35 *
36 * @var string
37 *
38 */
39 protected $_from_contact_id;
40 /**
41 * last name of the particpant to transfer to
42 *
43 * @var string
44 *
45 */
46 protected $_to_contact_last_name;
47 /**
48 * first name of the particpant to transfer to
49 *
50 * @var string
51 *
52 */
53 protected $_to_contact_first_name;
54 /**
55 * email of participant
56 *
57 *
58 * @var string
59 */
60 protected $_to_contact_email;
61 /**
62 * _to_contact_id
63 *
64 * @var string
65 */
66 protected $_to_contact_id;
67 /**
68 * event to be cancelled/transferred
69 *
70 * @var string
71 */
72 protected $_event_id;
73 /**
74 * event title
75 *
76 * @var string
77 */
78 protected $_event_title;
79 /**
80 * event title
81 *
82 * @var string
83 */
84 protected $_event_start_date;
85 /**
86 * action
87 *
88 * @var string
89 */
3a936dab 90 public $_action;
97d8187a
DG
91 /**
92 * participant object
93 *
94 * @var string
95 */
be2fb01f 96 protected $_participant = [];
97d8187a
DG
97 /**
98 * particpant values
99 *
90b461f1 100 * @var string
97d8187a
DG
101 */
102 protected $_part_values;
103 /**
104 * details
105 *
90b461f1 106 * @var array
97d8187a 107 */
be2fb01f 108 protected $_details = [];
97d8187a
DG
109 /**
110 * line items
111 *
90b461f1 112 * @var array
97d8187a 113 */
be2fb01f 114 protected $_line_items = [];
97d8187a
DG
115 /**
116 * contact_id
117 *
90b461f1 118 * @var int
97d8187a
DG
119 */
120 protected $contact_id;
974bdb44 121
e219d53b 122 /**
123 * Is backoffice form?
124 *
90b461f1 125 * @var bool
e219d53b 126 */
127 protected $isBackoffice = FALSE;
128
97d8187a
DG
129 /**
130 * Get source values for transfer based on participant id in URL. Line items will
131 * be transferred to this participant - at this point no transaction changes processed
132 *
133 * return @void
134 */
135 public function preProcess() {
136 $config = CRM_Core_Config::singleton();
137 $session = CRM_Core_Session::singleton();
138 $this->_userContext = $session->readUserContext();
139 $this->_from_participant_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this, FALSE, NULL, 'REQUEST');
af29aaac 140 $this->_userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE, NULL, 'REQUEST');
e219d53b 141 $this->isBackoffice = CRM_Utils_Request::retrieve('is_backoffice', 'String', $this, FALSE, NULL, 'REQUEST');
be2fb01f
CW
142 $params = ['id' => $this->_from_participant_id];
143 $participant = $values = [];
97d8187a
DG
144 $this->_participant = CRM_Event_BAO_Participant::getValues($params, $values, $participant);
145 $this->_part_values = $values[$this->_from_participant_id];
146 $this->set('values', $this->_part_values);
147 $this->_event_id = $this->_part_values['event_id'];
af29aaac 148 $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}");
97d8187a 149 $this->_from_contact_id = $this->_part_values['participant_contact_id'];
af29aaac 150 $validUser = CRM_Contact_BAO_Contact_Utils::validChecksum($this->_from_contact_id, $this->_userChecksum);
151 if (!$validUser && !CRM_Core_Permission::check('edit all events')) {
152 CRM_Core_Error::statusBounce(ts('You do not have sufficient permission to transfer/cancel this participant.'), $url);
153 }
97d8187a
DG
154 $this->assign('action', $this->_action);
155 if ($this->_from_participant_id) {
156 $this->assign('participantId', $this->_from_participant_id);
157 }
be2fb01f 158 $event = [];
97d8187a
DG
159 $daoName = 'title';
160 $this->_event_title = CRM_Event_BAO_Event::getFieldValue('CRM_Event_DAO_Event', $this->_event_id, $daoName);
161 $daoName = 'start_date';
162 $this->_event_start_date = CRM_Event_BAO_Event::getFieldValue('CRM_Event_DAO_Event', $this->_event_id, $daoName);
163 list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_from_contact_id);
164 $this->_contact_name = $displayName;
165 $this->_contact_email = $email;
be2fb01f 166 $details = [];
97d8187a 167 $details = CRM_Event_BAO_Participant::participantDetails($this->_from_participant_id);
4abc4ee1 168 $optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'participant_role', 'id', 'name');
97d8187a 169 $query = "
974bdb44 170 SELECT cpst.name as status, cov.name as role, cp.fee_level, cp.fee_amount, cp.register_date, civicrm_event.start_date
97d8187a
DG
171 FROM civicrm_participant cp
172 LEFT JOIN civicrm_participant_status_type cpst ON cpst.id = cp.status_id
4abc4ee1 173 LEFT JOIN civicrm_option_value cov ON cov.value = cp.role_id and cov.option_group_id = {$optionGroupId}
974bdb44 174 LEFT JOIN civicrm_event ON civicrm_event.id = cp.event_id
97d8187a 175 WHERE cp.id = {$this->_from_participant_id}";
33621c4f 176 $dao = CRM_Core_DAO::executeQuery($query);
97d8187a
DG
177 while ($dao->fetch()) {
178 $details['status'] = $dao->status;
179 $details['role'] = $dao->role;
180 $details['fee_level'] = $dao->fee_level;
181 $details['fee_amount'] = $dao->fee_amount;
182 $details['register_date'] = $dao->register_date;
0d21c8b1 183 $details['event_start_date'] = $dao->start_date;
97d8187a
DG
184 }
185 $this->assign('details', $details);
186 //This participant row will be cancelled. Get line item(s) to cancel
187 $this->selfsvctransferUrl = CRM_Utils_System::url('civicrm/event/selfsvcupdate',
188 "reset=1&id={$this->_from_participant_id}&id=0");
189 $this->selfsvctransferText = ts('Update');
190 $this->selfsvctransferButtonText = ts('Update');
191 }
974bdb44 192
97d8187a
DG
193 /**
194 * Build form for input of transferree email, name
195 *
196 * return @void
197 */
198 public function buildQuickForm() {
e219d53b 199 // use entityRef select field for contact when this form is used by staff/admin user
200 if ($this->isBackoffice) {
be2fb01f 201 $this->addEntityRef("contact_id", ts('Select Contact'), ['create' => TRUE], TRUE);
e219d53b 202 }
203 // for front-end user show and use the basic three fields used to create a contact
204 else {
6dabf459
ML
205 $this->add('text', 'email', ts('To Email'), $this->_contact_email, TRUE);
206 $this->add('text', 'last_name', ts('To Last Name'), $this->_to_contact_last_name, TRUE);
207 $this->add('text', 'first_name', ts('To First Name'), $this->_to_contact_first_name, TRUE);
e219d53b 208 }
209
be2fb01f
CW
210 $this->addButtons([
211 [
97d8187a 212 'type' => 'submit',
be2fb01f
CW
213 'name' => ts('Transfer Registration'),
214 ],
215 ]);
216 $this->addFormRule(['CRM_Event_Form_SelfSvcTransfer', 'formRule'], $this);
97d8187a
DG
217 parent::buildQuickForm();
218 }
974bdb44 219
97d8187a
DG
220 /**
221 * Set defaults
222 *
223 * return @array _defaults
224 */
225 public function setDefaultValues() {
be2fb01f 226 $this->_defaults = [];
97d8187a
DG
227 return $this->_defaults;
228 }
974bdb44 229
97d8187a
DG
230 /**
231 * Validate email and name input
232 *
233 * return array $errors
234 */
235 public static function formRule($fields, $files, $self) {
be2fb01f 236 $errors = [];
e219d53b 237 if (!empty($fields['contact_id'])) {
238 $to_contact_id = $fields['contact_id'];
239 }
240 else {
241 //check that either an email or firstname+lastname is included in the form(CRM-9587)
242 $to_contact_id = self::checkProfileComplete($fields, $errors, $self);
243 }
97d8187a 244 //To check if the user is already registered for the event(CRM-2426)
e219d53b 245 if (!empty($to_contact_id)) {
e3b510fe 246 self::checkRegistration($fields, $self, $to_contact_id, $errors);
247 }
97d8187a
DG
248 //return parent::formrule($fields, $files, $self);
249 return empty($errors) ? TRUE : $errors;
250 }
974bdb44 251
97d8187a
DG
252 /**
253 * Check whether profile (name, email) is complete
254 *
255 * return $contact_id
256 */
257 public static function checkProfileComplete($fields, &$errors, $self) {
258 $email = '';
259 foreach ($fields as $fieldname => $fieldvalue) {
260 if (substr($fieldname, 0, 5) == 'email' && $fieldvalue) {
261 $email = $fieldvalue;
262 }
263 }
264 if (!$email && !(CRM_Utils_Array::value('first_name', $fields) &&
265 CRM_Utils_Array::value('last_name', $fields))) {
be2fb01f 266 $defaults = $params = ['id' => $eventId];
97d8187a
DG
267 CRM_Event_BAO_Event::retrieve($params, $defaults);
268 $message = ts("Mandatory fields (first name and last name, OR email address) are missing from this form.");
269 $errors['_qf_default'] = $message;
270 }
271 $contact = CRM_Contact_BAO_Contact::matchContactOnEmail($email, "");
272 $contact_id = empty($contact->contact_id) ? NULL : $contact->contact_id;
e3b510fe 273 if (!CRM_Utils_Rule::email($fields['email'])) {
274 $errors['email'] = ts('Enter valid email address.');
275 }
276 if (empty($errors) && empty($contact_id)) {
be2fb01f 277 $params = [
97d8187a
DG
278 'email-Primary' => CRM_Utils_Array::value('email', $fields, NULL),
279 'first_name' => CRM_Utils_Array::value('first_name', $fields, NULL),
280 'last_name' => CRM_Utils_Array::value('last_name', $fields, NULL),
be2fb01f
CW
281 'is_deleted' => CRM_Utils_Array::value('is_deleted', $fields, FALSE),
282 ];
97d8187a
DG
283 //create new contact for this name/email pair
284 //if new contact, no need to check for contact already registered
285 $contact_id = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $contact_id);
286 }
287 return $contact_id;
288 }
974bdb44 289
97d8187a
DG
290 /**
291 * Check contact details
292 *
293 * return @void
294 */
4abc4ee1 295 public static function checkRegistration($fields, $self, $contact_id, &$errors) {
97d8187a 296 // verify whether this contact already registered for this event
97d8187a
DG
297 $contact_details = CRM_Contact_BAO_Contact::getContactDetails($contact_id);
298 $display_name = $contact_details[0];
299 $query = "select event_id from civicrm_participant where contact_id = " . $contact_id;
33621c4f 300 $dao = CRM_Core_DAO::executeQuery($query);
97d8187a 301 while ($dao->fetch()) {
90b461f1 302 $to_event_id[] = $dao->event_id;
97d8187a
DG
303 }
304 if (!empty($to_event_id)) {
305 foreach ($to_event_id as $id) {
306 if ($id == $self->_event_id) {
4abc4ee1 307 $errors['email'] = $display_name . ts(" is already registered for this event");
97d8187a
DG
308 }
309 }
310 }
311 }
974bdb44 312
97d8187a
DG
313 /**
314 * Process transfer - first add the new participant to the event, then cancel
315 * source participant - send confirmation email to transferee
316 */
317 public function postProcess() {
318 //For transfer, process form to allow selection of transferree
319 $params = $this->controller->exportValues($this->_name);
e219d53b 320 if (!empty($params['contact_id'])) {
321 $contact_id = $params['contact_id'];
322 }
323 else {
324 //cancel 'from' participant row
be2fb01f 325 $contact_id_result = civicrm_api3('Contact', 'get', [
d4a64d9a 326 'sequential' => 1,
be2fb01f 327 'return' => ["id"],
d4a64d9a 328 'email' => $params['email'],
be2fb01f
CW
329 'options' => ['limit' => 1],
330 ]);
d4a64d9a
AS
331 $contact_id_result = $contact_id_result['values'][0];
332 $contact_id = $contact_id_result['contact_id'];
333 $contact_is_deleted = $contact_id_result['contact_is_deleted'];
334 if ($contact_is_deleted || !is_numeric($contact_id)) {
2ddf0fcd 335 CRM_Core_Error::statusBounce(ts('Contact does not exist.'));
e219d53b 336 }
97d8187a 337 }
be2fb01f 338 $from_participant = $params = [];
97d8187a 339 $query = "select role_id, source, fee_level, is_test, is_pay_later, fee_amount, discount_id, fee_currency,campaign_id, discount_amount from civicrm_participant where id = " . $this->_from_participant_id;
33621c4f 340 $dao = CRM_Core_DAO::executeQuery($query);
be2fb01f 341 $value_to = [];
97d8187a
DG
342 while ($dao->fetch()) {
343 $value_to['role_id'] = $dao->role_id;
344 $value_to['source'] = $dao->source;
345 $value_to['fee_level'] = $dao->fee_level;
346 $value_to['is_test'] = $dao->is_test;
347 $value_to['is_pay_later'] = $dao->is_pay_later;
348 $value_to['fee_amount'] = $dao->fee_amount;
349 }
350 $value_to['contact_id'] = $contact_id;
351 $value_to['event_id'] = $this->_event_id;
35538401
PN
352 $value_to['status_id'] = CRM_Core_PseudoConstant::getKey(
353 'CRM_Event_BAO_Participant',
354 'status_id',
355 'Registered'
356 );
97d8187a
DG
357 $value_to['register_date'] = date("Y-m-d");
358 //first create the new participant row -don't set registered_by yet or email won't be sent
359 $participant = CRM_Event_BAO_Participant::create($value_to);
360 //send a confirmation email to the new participant
e3b510fe 361 $this->participantTransfer($participant);
97d8187a
DG
362 //now update registered_by_id
363 $query = "UPDATE civicrm_participant cp SET cp.registered_by_id = %1 WHERE cp.id = ({$participant->id})";
be2fb01f 364 $params = [1 => [$this->_from_participant_id, 'Integer']];
97d8187a
DG
365 $dao = CRM_Core_DAO::executeQuery($query, $params);
366 //copy line items to new participant
367 $line_items = CRM_Price_BAO_LineItem::getLineItems($this->_from_participant_id);
368 foreach ($line_items as $item) {
369 $item['entity_id'] = $participant->id;
370 $item['id'] = NULL;
371 $item['entity_table'] = "civicrm_participant";
372 $new_item = CRM_Price_BAO_LineItem::create($item);
373 }
374 //now cancel the from participant record, leaving the original line-item(s)
be2fb01f 375 $value_from = [];
97d8187a
DG
376 $value_from['id'] = $this->_from_participant_id;
377 $tansferId = array_search('Transferred', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
378 $value_from['status_id'] = $tansferId;
379 $value_from['transferred_to_contact_id'] = $contact_id;
380 $contact_details = CRM_Contact_BAO_Contact::getContactDetails($contact_id);
381 $display_name = current($contact_details);
382 $this->assign('to_participant', $display_name);
383 CRM_Event_BAO_Participant::create($value_from);
384 $this->sendCancellation();
385 list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
be2fb01f
CW
386 $statusMsg = ts('Event registration information for %1 has been updated.', [1 => $displayName]);
387 $statusMsg .= ' ' . ts('A confirmation email has been sent to %1.', [1 => $email]);
974bdb44 388 CRM_Core_Session::setStatus($statusMsg, ts('Registration Transferred'), 'success');
e219d53b 389 if ($this->isBackoffice) {
390 return;
391 }
e3b510fe 392 $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}");
393 CRM_Utils_System::redirect($url);
97d8187a 394 }
974bdb44 395
97d8187a
DG
396 /**
397 * Based on input, create participant row for transferee and send email
398 *
399 * return @ void
400 */
401 public function participantTransfer($participant) {
be2fb01f 402 $contactDetails = [];
97d8187a
DG
403 $contactIds[] = $participant->contact_id;
404 list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
be2fb01f 405 FALSE, FALSE, NULL, [], 'CRM_Event_BAO_Participant');
97d8187a
DG
406 foreach ($currentContactDetails as $contactId => $contactValues) {
407 $contactDetails[$contactId] = $contactValues;
408 }
409 $participantRoles = CRM_Event_PseudoConstant::participantRole();
be2fb01f 410 $participantDetails = [];
97d8187a
DG
411 $query = "SELECT * FROM civicrm_participant WHERE id = " . $participant->id;
412 $dao = CRM_Core_DAO::executeQuery($query);
413 while ($dao->fetch()) {
be2fb01f 414 $participantDetails[$dao->id] = [
97d8187a
DG
415 'id' => $dao->id,
416 'role' => $participantRoles[$dao->role_id],
417 'is_test' => $dao->is_test,
418 'event_id' => $dao->event_id,
419 'status_id' => $dao->status_id,
420 'fee_amount' => $dao->fee_amount,
421 'contact_id' => $dao->contact_id,
422 'register_date' => $dao->register_date,
423 'registered_by_id' => $dao->registered_by_id,
be2fb01f 424 ];
97d8187a 425 }
be2fb01f 426 $domainValues = [];
97d8187a
DG
427 if (empty($domainValues)) {
428 $domain = CRM_Core_BAO_Domain::getDomain();
be2fb01f 429 $tokens = [
97d8187a 430 'domain' =>
be2fb01f 431 [
97d8187a
DG
432 'name',
433 'phone',
434 'address',
435 'email',
be2fb01f 436 ],
97d8187a 437 'contact' => CRM_Core_SelectValues::contactTokens(),
be2fb01f 438 ];
97d8187a
DG
439 foreach ($tokens['domain'] as $token) {
440 $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
441 }
442 }
be2fb01f
CW
443 $eventDetails = [];
444 $eventParams = ['id' => $participant->event_id];
e3b510fe 445 CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails);
97d8187a 446 //get default participant role.
e3b510fe 447 $eventDetails['participant_role'] = CRM_Utils_Array::value($eventDetails['default_role_id'], $participantRoles);
97d8187a 448 //get the location info
be2fb01f 449 $locParams = [
97d8187a
DG
450 'entity_id' => $participant->event_id,
451 'entity_table' => 'civicrm_event',
be2fb01f 452 ];
e3b510fe 453 $eventDetails['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
454 $toEmail = CRM_Utils_Array::value('email', $contactDetails[$participant->contact_id]);
455 if ($toEmail) {
456 //take a receipt from as event else domain.
457 $receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>';
458 if (!empty($eventDetails['confirm_from_name']) && !empty($eventDetails['confirm_from_email'])) {
459 $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>';
460 }
461 $participantName = $contactDetails[$participant->contact_id]['display_name'];
be2fb01f 462 $tplParams = [
e3b510fe 463 'event' => $eventDetails,
464 'participant' => $participantDetails[$participant->id],
465 'participantID' => $participant->id,
466 'participant_status' => 'Registered',
be2fb01f 467 ];
e3b510fe 468
be2fb01f 469 $sendTemplateParams = [
e3b510fe 470 'groupName' => 'msg_tpl_workflow_event',
471 'valueName' => 'event_online_receipt',
472 'contactId' => $participantDetails[$participant->id]['contact_id'],
473 'tplParams' => $tplParams,
474 'from' => $receiptFrom,
475 'toName' => $participantName,
476 'toEmail' => $toEmail,
477 'cc' => CRM_Utils_Array::value('cc_confirm', $eventDetails),
478 'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventDetails),
be2fb01f 479 ];
e3b510fe 480 CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
481 }
97d8187a 482 }
974bdb44 483
97d8187a
DG
484 /**
485 * Send confirmation of cancellation to source participant
486 *
487 * return @ void
488 */
489 public function sendCancellation() {
be2fb01f 490 $domainValues = [];
97d8187a 491 $domain = CRM_Core_BAO_Domain::getDomain();
be2fb01f 492 $tokens = [
97d8187a 493 'domain' =>
be2fb01f 494 [
97d8187a
DG
495 'name',
496 'phone',
497 'address',
498 'email',
be2fb01f 499 ],
97d8187a 500 'contact' => CRM_Core_SelectValues::contactTokens(),
be2fb01f 501 ];
97d8187a
DG
502 foreach ($tokens['domain'] as $token) {
503 $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
504 }
be2fb01f 505 $participantRoles = [];
97d8187a 506 $participantRoles = CRM_Event_PseudoConstant::participantRole();
be2fb01f 507 $participantDetails = [];
97d8187a
DG
508 $query = "SELECT * FROM civicrm_participant WHERE id = {$this->_from_participant_id}";
509 $dao = CRM_Core_DAO::executeQuery($query);
510 while ($dao->fetch()) {
be2fb01f 511 $participantDetails[$dao->id] = [
97d8187a
DG
512 'id' => $dao->id,
513 'role' => $participantRoles[$dao->role_id],
514 'is_test' => $dao->is_test,
515 'event_id' => $dao->event_id,
516 'status_id' => $dao->status_id,
517 'fee_amount' => $dao->fee_amount,
518 'contact_id' => $dao->contact_id,
519 'register_date' => $dao->register_date,
520 'registered_by_id' => $dao->registered_by_id,
be2fb01f 521 ];
97d8187a 522 }
be2fb01f
CW
523 $eventDetails = [];
524 $eventParams = ['id' => $this->_event_id];
97d8187a
DG
525 CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
526 //get default participant role.
527 $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
528 //get the location info
be2fb01f 529 $locParams = ['entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event'];
97d8187a
DG
530 $eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
531 //get contact details
532 $contactIds[$this->_from_contact_id] = $this->_from_contact_id;
533 list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
be2fb01f 534 FALSE, FALSE, NULL, [],
97d8187a
DG
535 'CRM_Event_BAO_Participant'
536 );
537 foreach ($currentContactDetails as $contactId => $contactValues) {
538 $contactDetails[$this->_from_contact_id] = $contactValues;
539 }
540 //send a 'cancelled' email to user, and cc the event's cc_confirm email
541 $mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_from_participant_id,
542 $participantDetails[$this->_from_participant_id],
543 $eventDetails[$this->_event_id],
544 $contactDetails[$this->_from_contact_id],
545 $domainValues,
546 "Transferred",
547 ""
548 );
be2fb01f
CW
549 $statusMsg = ts('Event registration information for %1 has been updated.', [1 => $this->_contact_name]);
550 $statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', [1 => $this->_contact_email]);
8b9023b8 551 CRM_Core_Session::setStatus($statusMsg, ts('Thanks'), 'success');
97d8187a
DG
552 }
553
554}