Fix notice in participant_cancelled email
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 18 Dec 2023 21:08:59 +0000 (10:08 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 19 Dec 2023 00:55:46 +0000 (13:55 +1300)
CRM/Event/WorkflowMessage/EventExamples.php
tests/phpunit/CRM/Event/Form/SelfSvcUpdateTest.php
xml/templates/message_templates/participant_cancelled_html.tpl
xml/templates/message_templates/participant_cancelled_subject.tpl
xml/templates/message_templates/participant_cancelled_text.tpl

index 9de84306fcae9670aa1d06f460eefb467fc6d254..6f7ed8ca4fb9591f1b47da919404b077b72fbe57 100644 (file)
@@ -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']]);
   }
 
   /**
index 26f2f398185c72f0fd47961cfdbf30571f0a25b3..7a5475eecbb96052be1d9fc849774bf9728a7cd0 100644 (file)
@@ -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]);
index 8011f94862b3741b54b178beb4c6f843b1bc15eb..90f4a1022c31dc889a484a84b1e6146f06a744f4 100644 (file)
@@ -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>
       </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}
index e3974098392273bdcd7c3f072574d6f11c9c498c..8a2708fb9718e9f52b8b745929614a04bdb37b26 100644 (file)
@@ -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}
index dedf895d880261c852be0c30ad74a739da0205a9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -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}
-