From 8c1d624ffa692436444ea7116e0fa0353aa3303e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 19 Dec 2023 10:08:59 +1300 Subject: [PATCH] Fix notice in participant_cancelled email --- CRM/Event/WorkflowMessage/EventExamples.php | 4 +- .../CRM/Event/Form/SelfSvcUpdateTest.php | 5 +- .../participant_cancelled_html.tpl | 107 +++++++++++------- .../participant_cancelled_subject.tpl | 2 +- .../participant_cancelled_text.tpl | 47 -------- 5 files changed, 72 insertions(+), 93 deletions(-) diff --git a/CRM/Event/WorkflowMessage/EventExamples.php b/CRM/Event/WorkflowMessage/EventExamples.php index 9de84306fc..6f7ed8ca4f 100644 --- a/CRM/Event/WorkflowMessage/EventExamples.php +++ b/CRM/Event/WorkflowMessage/EventExamples.php @@ -33,7 +33,7 @@ class CRM_Event_WorkflowMessage_EventExamples extends WorkflowMessageExample { * @throws \CRM_Core_Exception */ public function getExamples(): iterable { - $workflows = ['event_online_receipt', 'event_offline_receipt']; + $workflows = ['event_online_receipt', 'event_offline_receipt', 'participant_cancelled', 'participant_confirm', 'participant_expired', 'participant_transferred', 'event_registration_receipt']; foreach ($workflows as $workflow) { $priceSets = $this->getPriceSets(); foreach ($priceSets as $priceSet) { @@ -141,7 +141,7 @@ United States'; $messageTemplate->setOrder($mockOrder); $messageTemplate->setParticipantContacts($participantContacts); $roleID = Event::get(FALSE)->addWhere('id', '=', $example['event_id'])->addSelect('default_role_id')->execute()->first()['default_role_id']; - $messageTemplate->setParticipant(['id' => $isPrimary ? $primaryParticipantID : $otherParticipantID, 'registered_by_id' => $isPrimary ? NULL : $primaryParticipantID, 'register_date' => date('Y-m-d'), 'role_id' => $roleID]); + $messageTemplate->setParticipant(['id' => $isPrimary ? $primaryParticipantID : $otherParticipantID, 'registered_by_id' => $isPrimary ? NULL : $primaryParticipantID, 'register_date' => date('Y-m-d'), 'role_id' => $roleID, 'event_id' => $example['event_id']]); } /** diff --git a/tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php b/tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php index 26f2f39818..7a5475eecb 100644 --- a/tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php +++ b/tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php @@ -30,9 +30,10 @@ class CRM_Event_Form_SelfSvcUpdateTest extends CiviUnitTestCase { $mut->checkAllMailLog([ 'Your Event Registration has been cancelled', 'Annual CiviCRM meet', - 'Registration Date: February 19th, 2007', + 'Registration Date', + 'February 19th, 2007', 'Please contact us at 123 or send email to fixme.domainemail@example.org', - 'October 21st, 2008 12:00 AM-October 23rd, 2008 12:00 AM', + 'Tuesday October 21st, 2008 12:00 AM-Thursday October 23rd, 2008 12:00 AM', ]); $emails = $mut->getAllMessages(); $this->assertStringContainsString('', $emails[0]); diff --git a/xml/templates/message_templates/participant_cancelled_html.tpl b/xml/templates/message_templates/participant_cancelled_html.tpl index 8011f94862..90f4a1022c 100644 --- a/xml/templates/message_templates/participant_cancelled_html.tpl +++ b/xml/templates/message_templates/participant_cancelled_html.tpl @@ -34,8 +34,8 @@ - {$event.event_title}
- {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|crmDate:"shortdate" == $event.event_start_date|crmDate:"shortdate"}{$event.event_end_date|crmDate:"Time"}{else}{$event.event_end_date|crmDate}{/if}{/if} + {event.title}
+ {event.start_date|crmDate:"%A"} {event.start_date|crmDate}{if {event.end_date|boolean}}-{if '{event.end_date|crmDate:"%Y%m%d"}' === '{event.start_date|crmDate:"%Y%m%d"}'}{event.end_date|crmDate:"Time"}{else}{event.end_date|crmDate:"%A"} {event.end_date|crmDate}{/if}{/if} @@ -47,47 +47,72 @@ - {if $isShowLocation} - - - {$event.location.address.1.display|nl2br} - - - {/if} + {if !empty($isShowLocation)} + + + {event.location} + + + {/if} - {if !empty($event.location.phone.1.phone) || !empty($event.location.email.1.email)} - - - {ts}Event Contacts:{/ts} - - - {foreach from=$event.location.phone item=phone} - {if $phone.phone} - - - {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if} - - - {$phone.phone} - - - {/if} - {/foreach} - {foreach from=$event.location.email item=eventEmail} - {if $eventEmail.email} - - - {ts}Email{/ts} - - - {$eventEmail.email} - - - {/if} - {/foreach} - {/if} + {if {event.loc_block_id.phone_id.phone|boolean} || {event.loc_block_id.email_id.email|boolean}} + + + {ts}Event Contacts:{/ts} + + + + {if {event.loc_block_id.phone_id.phone|boolean}} + + + {if {event.loc_block_id.phone_id.phone_type_id|boolean}} + {event.loc_block_id.phone_id.phone_type_id:label} + {else} + {ts}Phone{/ts} + {/if} + + + {event.loc_block_id.phone_id.phone} {if {event.loc_block_id.phone_id.phone_ext|boolean}} {ts}ext.{/ts} {event.loc_block_id.phone_id.phone_ext}{/if} + + + {/if} + {if {event.loc_block_id.phone_2_id.phone|boolean}} + + + {if {event.loc_block_id.phone_2_id.phone_type_id|boolean}} + {event.loc_block_id.phone_2_id.phone_type_id:label} + {else} + {ts}Phone{/ts} + {/if} + + + {event.loc_block_id.phone_2_id.phone} {if {event.loc_block_id.phone_2_id.phone_ext|boolean}} {ts}ext.{/ts} {event.loc_block_id.phone_2_id.phone_ext}{/if} + + + {/if} + {if {event.loc_block_id.email_id.email|boolean}} + + + {ts}Email{/ts} + + + {event.loc_block_id.email_id.email} + + + {/if} + {if {event.loc_block_id.email_2_id.email|boolean}} + + + {ts}Email{/ts} + + + {event.loc_block_id.email_2_id.email} + + + {/if} + {/if} - {if '{contact.email}'} + {if '{contact.email}'} {ts}Registered Email{/ts} diff --git a/xml/templates/message_templates/participant_cancelled_subject.tpl b/xml/templates/message_templates/participant_cancelled_subject.tpl index e397409839..8a2708fb97 100644 --- a/xml/templates/message_templates/participant_cancelled_subject.tpl +++ b/xml/templates/message_templates/participant_cancelled_subject.tpl @@ -1 +1 @@ -{ts 1=$event.event_title}Event Registration Cancelled for %1{/ts} - {contact.display_name} +{ts 1="{event.title}"}Event Registration Cancelled for %1{/ts} - {contact.display_name} diff --git a/xml/templates/message_templates/participant_cancelled_text.tpl b/xml/templates/message_templates/participant_cancelled_text.tpl index dedf895d88..e69de29bb2 100644 --- a/xml/templates/message_templates/participant_cancelled_text.tpl +++ b/xml/templates/message_templates/participant_cancelled_text.tpl @@ -1,47 +0,0 @@ -{assign var="greeting" value="{contact.email_greeting_display}"}{if $greeting}{$greeting},{/if} - -{ts}Your Event Registration has been cancelled.{/ts} - - -=========================================================== -{ts}Event Information and Location{/ts} - -=========================================================== -{$event.event_title} -{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|crmDate:"shortdate" == $event.event_start_date|crmDate:"shortdate"}{$event.event_end_date|crmDate:"Time"}{else}{$event.event_end_date|crmDate}{/if}{/if} - -{ts}Participant Role{/ts}: {participant.role_id:label} - -{if $isShowLocation} -{$event.location.address.1.display|strip_tags:false} -{/if}{*End of isShowLocation condition*} - -{if !empty($event.location.phone.1.phone) || !empty($event.location.email.1.email)} - -{ts}Event Contacts:{/ts} -{foreach from=$event.location.phone item=phone} -{if $phone.phone} - -{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} -{/foreach} -{foreach from=$event.location.email item=eventEmail} -{if $eventEmail.email} - -{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach} -{/if} - -{if '{contact.email}'} - -=========================================================== -{ts}Registered Email{/ts} - -=========================================================== -{contact.email} -{/if} - -{if !empty('{participant.register_date}')} -{ts}Registration Date{/ts}: {participant.register_date} -{/if} - -{ts 1='{domain.phone}' 2='{domain.email}'}Please contact us at %1 or send email to %2 if you have questions.{/ts} - -- 2.25.1