Skip to content

Commit

Permalink
Fix notice in participant_cancelled email
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Dec 19, 2023
1 parent 07aaff1 commit 8c1d624
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 93 deletions.
4 changes: 2 additions & 2 deletions CRM/Event/WorkflowMessage/EventExamples.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -141,7 +141,7 @@ private function addExampleData(GenericWorkflowMessage $messageTemplate, array $
$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']]);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ public function testForm(): void {
$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 [email protected]',
'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]);
Expand Down
107 changes: 66 additions & 41 deletions xml/templates/message_templates/participant_cancelled_html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$event.event_title}<br />
{$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}<br />
{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}
</td>
</tr>
<tr>
Expand All @@ -47,47 +47,72 @@
</td>
</tr>

{if $isShowLocation}
<tr>
<td colspan="2" {$valueStyle}>
{$event.location.address.1.display|nl2br}
</td>
</tr>
{/if}
{if !empty($isShowLocation)}
<tr>
<td colspan="2" {$valueStyle}>
{event.location}
</td>
</tr>
{/if}

{if !empty($event.location.phone.1.phone) || !empty($event.location.email.1.email)}
<tr>
<td colspan="2" {$labelStyle}>
{ts}Event Contacts:{/ts}
</td>
</tr>
{foreach from=$event.location.phone item=phone}
{if $phone.phone}
<tr>
<td {$labelStyle}>
{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}
</td>
<td {$valueStyle}>
{$phone.phone}
</td>
</tr>
{/if}
{/foreach}
{foreach from=$event.location.email item=eventEmail}
{if $eventEmail.email}
<tr>
<td {$labelStyle}>
{ts}Email{/ts}
</td>
<td {$valueStyle}>
{$eventEmail.email}
</td>
</tr>
{/if}
{/foreach}
{/if}
{if {event.loc_block_id.phone_id.phone|boolean} || {event.loc_block_id.email_id.email|boolean}}
<tr>
<td colspan="2" {$labelStyle}>
{ts}Event Contacts:{/ts}
</td>
</tr>

{if {event.loc_block_id.phone_id.phone|boolean}}
<tr>
<td {$labelStyle}>
{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}
</td>
<td {$valueStyle}>
{event.loc_block_id.phone_id.phone} {if {event.loc_block_id.phone_id.phone_ext|boolean}}&nbsp;{ts}ext.{/ts} {event.loc_block_id.phone_id.phone_ext}{/if}
</td>
</tr>
{/if}
{if {event.loc_block_id.phone_2_id.phone|boolean}}
<tr>
<td {$labelStyle}>
{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}
</td>
<td {$valueStyle}>
{event.loc_block_id.phone_2_id.phone} {if {event.loc_block_id.phone_2_id.phone_ext|boolean}}&nbsp;{ts}ext.{/ts} {event.loc_block_id.phone_2_id.phone_ext}{/if}
</td>
</tr>
{/if}
{if {event.loc_block_id.email_id.email|boolean}}
<tr>
<td {$labelStyle}>
{ts}Email{/ts}
</td>
<td {$valueStyle}>
{event.loc_block_id.email_id.email}
</td>
</tr>
{/if}
{if {event.loc_block_id.email_2_id.email|boolean}}
<tr>
<td {$labelStyle}>
{ts}Email{/ts}
</td>
<td {$valueStyle}>
{event.loc_block_id.email_2_id.email}
</td>
</tr>
{/if}
{/if}

{if '{contact.email}'}
{if '{contact.email}'}
<tr>
<th {$headerStyle}>
{ts}Registered Email{/ts}
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
47 changes: 0 additions & 47 deletions xml/templates/message_templates/participant_cancelled_text.tpl
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 8c1d624

Please sign in to comment.