}
}
}
- $this->assign('totalTaxAmount', $totalTaxAmount);
$this->assign('taxTerm', $this->getSalesTaxTerm());
$this->assign('dataArray', $dataArray);
}
$eventAmount = array_merge($eventAmount, $additionalParticipantDetails);
$this->assign('amount', $eventAmount);
}
-
+ $this->assign('totalTaxAmount', $totalTaxAmount ?? 0);
$sendTemplateParams = [
- 'groupName' => 'msg_tpl_workflow_event',
- 'valueName' => 'event_offline_receipt',
+ 'workflow' => 'event_offline_receipt',
'contactId' => $contactID,
'isTest' => !empty($this->_defaultValues['is_test']),
'PDFFilename' => ts('confirmation') . '.pdf',
+ 'modelProps' => [
+ 'participantID' => $this->_id,
+ 'eventID' => $params['event_id'],
+ ],
];
// try to send emails only if email id is present
$this->assign('isOnWaitlist', TRUE);
}
$this->assign('contactID', $this->_contactId);
- $this->assign('participantID', $this->_participantId);
$sendTemplateParams = [
- 'groupName' => 'msg_tpl_workflow_event',
- 'valueName' => 'event_offline_receipt',
+ 'workflow' => 'event_offline_receipt',
'contactId' => $this->_contactId,
'isTest' => FALSE,
'PDFFilename' => ts('confirmation') . '.pdf',
+ 'modelProps' => [
+ 'participantID' => $this->_participantId,
+ 'eventID' => $params['event_id'],
+ ],
];
// try to send emails only if email id is present
*
*/
protected function getExposedFields(): array {
- return ['event_type_id',
+ return [
+ 'event_type_id',
'title',
'id',
'event_tz',
+ 'pay_later_receipt',
'start_date',
'end_date',
'summary',
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+use Civi\WorkflowMessage\GenericWorkflowMessage;
+
+/**
+ * Receipt sent when confirming a back office participation record.
+ *
+ * @support template-only
+ *
+ * @see CRM_Event_Form_Participant::submit()
+ * @see CRM_Event_Form_ParticipantFeeSelection::emailReceipt
+ */
+class CRM_Event_WorkflowMessage_EventOfflineReceipt extends GenericWorkflowMessage {
+ use CRM_Event_WorkflowMessage_ParticipantTrait;
+ public const WORKFLOW = 'event_offline_receipt';
+
+}
/**
* @var int
*
- * @scope tokenContext as participantId
+ * @scope tokenContext as participantId, tplParams as participantID
*/
- public $participantId;
+ public $participantID;
+
+ /**
+ * @var int
+ *
+ * @scope tokenContext as eventId, tplParams as eventID
+ */
+ public $eventID;
}
<?php
+use Civi\Api4\Participant;
+
/**
* Test CRM_Event_Form_Registration functions.
*
parent::setUp();
}
- /**
- * Should financials be checked after the test but before tear down.
- *
- * @var bool
- */
- protected $isValidateFinancialsOnPostAssert = TRUE;
-
/**
* Initial test of submit function.
*
* @throws \Exception
*/
- public function testSubmit() {
+ public function testSubmit(): void {
$form = $this->getForm();
$form->submit([
'register_date' => date('Ymd'),
* @dataProvider getThousandSeparators
* @throws \Exception
*/
- public function testParticipantOfflineReceipt($thousandSeparator) {
+ public function testParticipantOfflineReceipt(string $thousandSeparator): void {
$this->setCurrencySeparators($thousandSeparator);
+ $this->swapMessageTemplateForTestTemplate('event_offline_receipt', 'text');
$mut = new CiviMailUtils($this, TRUE);
// Create an email associated with the logged in contact
$loggedInContactID = $this->createLoggedInUser();
// Use the email created as the from email ensuring we are passing a numeric from to test dev/core#1069
$this->setCurrencySeparators($thousandSeparator);
- $form = $this->getForm(['is_monetary' => 1, 'financial_type_id' => 1]);
+ $form = $this->getForm(['is_monetary' => 1, 'financial_type_id' => 1, 'pay_later_receipt' => 'pay us']);
$form->_mode = 'Live';
$form->_quickConfig = TRUE;
$form->_fromEmails = [
$submitParams = $this->getSubmitParamsForCreditCardPayment($paymentProcessorID);
$submitParams['from_email_address'] = $email['id'];
$form->submit($submitParams);
+ $participantID = Participant::get()->addWhere('event_id', '=', $this->getEventID())->execute()->first()['id'];
//Check if type is correctly populated in mails.
//Also check the string email is present not numeric from.
$mut->checkMailLog([
+ 'contactID:::' . $this->getContactID(),
+ 'contact.id:::' . $this->getContactID(),
+ 'eventID:::' . $this->getEventID(),
+ 'event.id:::' . $this->getEventID(),
+ 'participantID:::' . $participantID,
+ 'participant.id:::' . $participantID,
'<p>Test event type - 1</p>',
+ 'event.title:::Annual CiviCRM meet',
+ 'participant.status_id:name:::Registered',
'testloggedinreceiptemail@civicrm.org',
+ 'event.pay_later_receipt:::pay us',
$this->formatMoneyInput(1550.55),
]);
+
$this->callAPISuccess('Email', 'delete', ['id' => $email['id']]);
}
event.info_url :' . CRM_Utils_System::url('civicrm/event/info', NULL, TRUE) . '&reset=1&id=1
event.registration_url :' . CRM_Utils_System::url('civicrm/event/register', NULL, TRUE) . '&reset=1&id=1
+event.pay_later_receipt :
event.custom_1 :my field
';
}
'{event.location}' => 'Event Location',
'{event.info_url}' => 'Event Info URL',
'{event.registration_url}' => 'Event Registration URL',
+ '{event.pay_later_receipt}' => 'Pay Later Receipt Text',
'{event.' . $this->getCustomFieldName('text') . '}' => 'Enter text here :: Group with field text',
];
}
--- /dev/null
+contactID:::{$contactID}
+eventID:::{$eventID}
+participantID:::{$participantID}
+contact.id:::{contact.id}
+event.id:::{event.id}
+participant.id:::{participant.id}
+event.title:::{event.title}
+participant.status_id:name:::{participant.status_id:name}
+email:::{$email}
+event.pay_later_receipt:::{event.pay_later_receipt}