Fix undefined property on fromEmails for Participant fee
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 22 Sep 2023 21:43:36 +0000 (09:43 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 22 Sep 2023 22:54:47 +0000 (10:54 +1200)
CRM/Event/Form/EventFees.php
CRM/Event/Form/Participant.php

index 5ef84b3c581c0121a07587de6f148994a670b071..4755e31e7c5d909fe410fc97edfa9b1d0afd8d53 100644 (file)
@@ -37,9 +37,6 @@ class CRM_Event_Form_EventFees {
     $form->_pId = CRM_Utils_Request::retrieve('participantId', 'Positive', $form);
     $form->_discountId = CRM_Utils_Request::retrieve('discountId', 'Positive', $form);
 
-    // @todo - stop setting this, call the function, as appropriate. This is in a weird place.
-    $form->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($form->_eventId);
-
     //CRM-6907 set event specific currency.
     if ($form->_eventId &&
       ($currency = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_eventId, 'currency'))
index b066d7edd2d3fc43e749cb240b20ece9df17d690..7cc8ccfb2804f865720e6cf74dcdffdeb77c0d80 100644 (file)
@@ -2147,6 +2147,8 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_
       }
     }
     $this->assign('customGroup', $customGroup);
+
+    $fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->getEventID());
     foreach ($this->_contactIds as $num => $contactID) {
       // Retrieve the name and email of the contact - this will be the TO for receipt email
       [, $this->_contributorEmail, $this->_toDoNotEmail] = CRM_Contact_BAO_Contact::getContactDetails($contactID);
@@ -2235,8 +2237,8 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_
         $sendTemplateParams['from'] = $params['from_email_address'];
         $sendTemplateParams['toName'] = $this->getContactValue('display_name');
         $sendTemplateParams['toEmail'] = $this->_contributorEmail;
-        $sendTemplateParams['cc'] = $this->_fromEmails['cc'] ?? NULL;
-        $sendTemplateParams['bcc'] = $this->_fromEmails['bcc'] ?? NULL;
+        $sendTemplateParams['cc'] = $fromEmails['cc'] ?? NULL;
+        $sendTemplateParams['bcc'] = $fromEmails['bcc'] ?? NULL;
       }
 
       //send email with pdf invoice