Remove conference sessions from core workflow messages
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 15 Sep 2023 23:08:07 +0000 (11:08 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 16 Sep 2023 20:34:33 +0000 (08:34 +1200)
These cause notices is some circumstance and it seems to make more
sense to remove than support them.

They are only available to be configured when the Event Cart is in play so
it's not clear it makes sense to fix core code for them

The Event cart is kinda on it's way out & I don't think it makes sense
to maintain conference sessions in the core templates to support this
extension which despite many attempts has never had much use & has always
been somewhat broken AFAIK.

Note that this change would affect sites with non-customised templates
but in time I think we would either move the assign to the cart or stop
assigning it

Also not the goal is to provide event-cart type functionality via form
builder

CRM/Event/BAO/Event.php
ext/eventcart/eventcart.php
tests/templates/message_templates/event_online_receipt_text.tpl
xml/templates/message_templates/event_online_receipt_html.tpl
xml/templates/message_templates/participant_confirm_html.tpl
xml/templates/message_templates/participant_confirm_text.tpl

index f2a5e6dee730e45ed8c40d273a8d03b6bb837f15..43e912f824cbae5dd625628e97c326cb0e44fbb4 100644 (file)
@@ -1147,8 +1147,6 @@ WHERE civicrm_event.is_active = 1
           $participantParams
         );
 
-        $sessions = CRM_Event_Cart_BAO_Conference::get_participant_sessions($participantId);
-
         // @todo - the goal is that all params available to the message template are explicitly defined here rather than
         // 'in a smattering of places'. Note that leakage can happen between mailings when not explicitly defined.
         if ($postProfileID) {
@@ -1172,7 +1170,6 @@ WHERE civicrm_event.is_active = 1
           'customPost_grouptitle' => $customPostTitles,
           'participantID' => $participantId,
           'contactID' => $contactID,
-          'conference_sessions' => $sessions,
           'credit_card_number' => CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $participantParams)),
           'credit_card_exp_date' => CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $participantParams))),
           'selfcancelxfer_time' => abs($values['event']['selfcancelxfer_time']),
index df46e2bc7f6ea6055194d3da3a7b7276e1bf5821..5e04fc8cc1f835ceefbc53b15930978aac5fd0be 100644 (file)
@@ -32,6 +32,19 @@ function eventcart_civicrm_install() {
   _eventcart_civix_civicrm_install();
 }
 
+/**
+ * Add the conference session variable to the template.
+ *
+ * @param array $params
+ * @param string $template
+ */
+function eventcart_civicrm_alterMailParams(&$params, $template) {
+  $workflow = $params['workflow'] ?? '';
+  if (($workflow === 'event_online_receipt' || $workflow === 'participant_confirm') && !empty($params['tokenContact']['participant']['id'])) {
+    $params['tplParams']['conference_sessions'] = CRM_Event_Cart_BAO_Conference::get_participant_sessions($params['tokenContact']['participant']['id']);
+  }
+}
+
 /**
  * Implements hook_civicrm_enable().
  *
index 4143e652b45fa90b08644295833b795fd869b23f..6f834da4f0411dc38c53ba4dd6aa85a32c38c2c2 100644 (file)
@@ -17,9 +17,6 @@ pricesetFieldsCount:::{$pricesetFieldsCount}
 {if !empty($isPrimary)}
 isPrimary:::{$isPrimary}
 {/if}
-{if !empty($conference_sessions)}
-conference_sessions:::{$conference_sessions}
-{/if}
 {if !empty($is_pay_later)}
 is_pay_later:::{$is_pay_later}
 {/if}
@@ -39,9 +36,6 @@ event.event_end_date:::{event.end_date|crmDate:"%Y%m%d"}
 event.is_monetary:::{$event.is_monetary}
 {/if}
 event.fee_label:::{event.fee_label}
-{if !empty($conference_sessions)}
-conference_sessions:::{$conference_sessions}
-{/if}
 {if !empty($event.participant_role)}
   event.participant_role::{$event.participant_role}
   defaultRole:::{$defaultRole}
index 3bda72c979a2d3f44192ee0834174241c1bb4caa..820d0aceb7c7c5e8a24105d4fb4c7d8f3e01820b 100644 (file)
           </td>
         </tr>
 
-        {if $conference_sessions}
-          <tr>
-            <td colspan="2" {$labelStyle}>
-              {ts}Your schedule:{/ts}
-            </td>
-          </tr>
-          <tr>
-            <td colspan="2" {$valueStyle}>
-              {assign var='group_by_day' value='NA'}
-              {foreach from=$conference_sessions item=session}
-                {if $session.start_date|crmDate:"%Y/%m/%d" != $group_by_day|crmDate:"%Y/%m/%d"}
-                  {assign var='group_by_day' value=$session.start_date}
-                  <em>{$group_by_day|crmDate:"%m/%d/%Y"}</em><br/>
-                {/if}
-                {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}
-                <br/>
-                {if $session.location}&nbsp;&nbsp;&nbsp;&nbsp;{$session.location}<br/>{/if}
-              {/foreach}
-            </td>
-          </tr>
-        {/if}
-
         {if !empty($event.participant_role) and $event.participant_role neq 'Attendee' and !empty($defaultRole)}
           <tr>
             <td {$labelStyle}>
index 5a2765a673bfe65468b56bdf41197d1badd5ff9b..039f98586207ff5ae1e2efa683edc38772b19c41 100644 (file)
        {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|crmDate:"%Y%m%d" == $event.event_start_date|crmDate:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
       </td>
      </tr>
-     {if $conference_sessions}
-      <tr>
-       <td colspan="2" {$labelStyle}>
-  {ts}Your schedule:{/ts}
-       </td>
-      </tr>
-      <tr>
-       <td colspan="2" {$valueStyle}>
-  {assign var='group_by_day' value='NA'}
-  {foreach from=$conference_sessions item=session}
-   {if $session.start_date|crmDate:"%Y/%m/%d" != $group_by_day|crmDate:"%Y/%m/%d"}
-    {assign var='group_by_day' value=$session.start_date}
-          <em>{$group_by_day|crmDate:"%m/%d/%Y"}</em><br />
-   {/if}
-   {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}<br />
-   {if $session.location}&nbsp;&nbsp;&nbsp;&nbsp;{$session.location}<br />{/if}
-  {/foreach}
-       </td>
-      </tr>
-     {/if}
      <tr>
       <td {$labelStyle}>
        {ts}Participant Role{/ts}:
index 4071637941179878d5d3fef06b99746d8496f66b..259fd8ef227bc06e67e4811ab750e2fd82f219f0 100644 (file)
@@ -23,24 +23,6 @@ Click this link to go to a web page where you can confirm your registration onli
 ===========================================================
 {$event.event_title}
 {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|crmDate:"%Y%m%d" == $event.event_start_date|crmDate:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
-{if $conference_sessions}
-
-
-{ts}Your schedule:{/ts}
-{assign var='group_by_day' value='NA'}
-{foreach from=$conference_sessions item=session}
-{if $session.start_date|crmDate:"%Y/%m/%d" != $group_by_day|crmDate:"%Y/%m/%d"}
-{assign var='group_by_day' value=$session.start_date}
-
-{$group_by_day|crmDate:"%m/%d/%Y"}
-
-
-{/if}
-{$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}
-{if $session.location}    {$session.location}{/if}
-{/foreach}
-{/if}
-
 
 {ts}Participant Role{/ts}: {$participant.role}