Replace all form-assigned variables from event workflow templates
The goal is to remove all form based variables from the event workflow templates in order to
- make them work consistently from whereever they are called
- make them display in preview mode (eg. with Message Admin extension)
- reduce hacky code in the form layer with associated brittleness & fragility
- eliminate the notices
- make the code more similar on event templates
To this end we have a few strategies
- Use tokens whereever possible. These are standardised across Workflow Templates & Event templates & follow consistent naming
- Establish consistent variables to be assigned at the WorkFlow layer where tokens are not suitable
Status
Workflow variables
-
$participants
- this is an array of all participants associated with the registration with details in subkeys:- contact_display_name
- line_items
- totals
-
$participantDetail
- the item from the above array that relates to the recipient participant -
$isPrimary
is this the primary participant -
$taxTerm
is broadly available in workflow templates - eg 'VAT' -
$isShowLineItems
(comes from the price set is_quick_config)
Tokens Tokens are available from event, participant, contact & contribution entities
To do
-
Work through variables $isOnWaitlist
$isRequireApproval
(all event forms) -
Replace $participant_status
with a token (online receipt) -
Replace is_pay_later with token (online receipt) -
Replace isAmountZero with token (online receipt) -
Replace isAdditionalParticipant with !$isPrimary (online receipt) -
Replace {$pay_later_receipt} with token (offline receipt) -
Replace event_confirm_text with token (online receipt) -
Replace $receive_date
, financialType (online receipt) -
Replace isShowLocation with token (online receipt) -
Make sense of $payer.name
(online receipt) -
Assign billingName, address from the ContributionWorkflowTrait or token - comes from civicrm_contribution.address_id.* -
Maybe credit_card_type, number etc come from the financial_trxn table -
Replace $lineItems|@count
with something from the participant array & doesn't used smarty-2-only |@count (online & offline receipt) -
Replace $priceSetFieldsCount with something from the workflow message template layer, also {foreach from=$lineItem item=pcount}
loop -
Replace $event.confirm_email_text with $userText
offline receipt -
Move event_registration_receipt to event cart - this extension is being phased out so we can let it go once that is the case -
Move assigning customGroups
to the workflow template (offline receipt) https://github.com/civicrm/civicrm-core/pull/27596 -
Move assigning profiles to the workflow template (online receipt) -
Get tokens & token substution & examples working for remaining participant templates -transfered, cancelled etc -
$hookDiscountMessage - ? not sure