Update online_event_template to use workflow message
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 19 Jun 2023 10:40:59 +0000 (22:40 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 24 Jun 2023 02:06:45 +0000 (19:06 -0700)
commite90b263a9ccd7c8106c98f5f7f82d4b267820f43
treebb920063b4c5c0f97b702be462dc3cf013d10f8e
parentbeb8871cd3a50d4f0d8d41fff59e05a96ab1f806
Update online_event_template to use workflow message

This updates the default online event template to use the variables assigned by
the workflow template

This works to standardise the variables previously in dataArray
, lineItem, totalAmount, taxAmount to reflect the
approach in other templates per
https://docs.civicrm.org/user/en/latest/email/message-templates/#variables-and-tokens-in-workflow-message-templates

However, for participants, per the helpful discussion at
https://github.com/civicrm/civicrm-core/pull/24576

the expectation is that the primaryParticipant gets the values for
all participants whereas the others only get line items,
tax breakdowns, totals that relate to them.

Hence I have assigned an array participants that holds detials for all participants
and the template iterates through them showing all or just the
one that relates to the assigned participant id depending on
whether it is primary.

This allows the template to display in the Message preview and should
also mean that those values that I have addressed will always reflect
the participantID being used. This also addresses some notices
and incompatibility with secure smarty.

However, there are still values I haven't made sense of, or otherwise left
out of the scope of this PR in the template.

Also note I updated the taxBreakdown in the contribution trait - I decided it
was cloberring the amount as it iterated through the line items - rather than
doing a running total.
CRM/Event/WorkflowMessage/ParticipantTrait.php
sql/civicrm_generated.mysql
tests/phpunit/CRM/Event/Form/Registration/ConfirmTest.php
xml/templates/message_templates/event_online_receipt_html.tpl
xml/templates/message_templates/event_online_receipt_text.tpl