Move generic preProcess function to the trait
authoreileen <emcnaughton@wikimedia.org>
Tue, 31 Mar 2020 22:32:39 +0000 (11:32 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 2 Apr 2020 07:41:37 +0000 (20:41 +1300)
This is still overriden on the contact email.

CRM/Activity/Form/Task/Email.php
CRM/Contact/Form/Task/EmailTrait.php
CRM/Contribute/Form/Task/Email.php
CRM/Event/Form/Task/Email.php
CRM/Member/Form/Task/Email.php

index 67a247ccd6b34e72265b79a5ae04502970c29114..ccddab7aef7c04f15fd43a72561d61a6167d8e84 100644 (file)
 class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
   use CRM_Contact_Form_Task_EmailTrait;
 
-  /**
-   * Build all the data structures needed to build the form.
-   *
-   * @throws \CiviCRM_API3_Exception
-   */
-  public function preProcess() {
-    CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
-    parent::preProcess();
-    $this->setContactIDs();
-    $this->assign('single', $this->_single);
-  }
-
   /**
    * List available tokens for this form.
    *
index 0c4776b1fec88010ddbf2f3b6b5407c5659bbb78..02602753dd38673f907acc39fda0c2dba0d1bb25 100644 (file)
@@ -68,6 +68,19 @@ trait CRM_Contact_Form_Task_EmailTrait {
    */
   public $_bccContactIds = [];
 
+  /**
+   * Build all the data structures needed to build the form.
+   *
+   * @throws \CiviCRM_API3_Exception
+   * @throws \CRM_Core_Exception
+   */
+  public function preProcess() {
+    CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
+    parent::preProcess();
+    $this->setContactIDs();
+    $this->assign('single', $this->_single);
+  }
+
   /**
    * Build the form object.
    *
index f4819c6957b76f2ba2e3822c8bf24a1f7daf448d..509c0e7dc0561a4af435da8118cf04d4e0b4718f 100644 (file)
 class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task {
   use CRM_Contact_Form_Task_EmailTrait;
 
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
-    parent::preProcess();
-
-    // we have all the contribution ids, so now we get the contact ids
-    parent::setContactIDs();
-
-    $this->assign('single', $this->_single);
-  }
-
   /**
    * List available tokens for this form.
    *
index 2da1720e362da2abcc82e95f8b79015706eb5a00..e771571054a3170fcf24a1c554f667237ca38174 100644 (file)
 class CRM_Event_Form_Task_Email extends CRM_Event_Form_Task {
   use CRM_Contact_Form_Task_EmailTrait;
 
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
-    parent::preProcess();
-
-    // we have all the participant ids, so now we get the contact ids
-    parent::setContactIDs();
-
-    $this->assign('single', $this->_single);
-  }
-
   /**
    * List available tokens for this form.
    *
index aa6c7f1776970c2ba58aefc8750796107b30e20f..8db66116e1ad23ba1c8cbf22ec82cdd48a4b8eb5 100644 (file)
 class CRM_Member_Form_Task_Email extends CRM_Member_Form_Task {
   use CRM_Contact_Form_Task_EmailTrait;
 
-  /**
-   * Build all the data structures needed to build the form.
-   *
-   * @return void
-   *
-   * @throws \CRM_Core_Exception
-   * @throws \CiviCRM_API3_Exception
-   */
-  public function preProcess() {
-    CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
-    parent::preProcess();
-
-    // we have all the membership ids, so now we get the contact ids
-    parent::setContactIDs();
-
-    $this->assign('single', $this->_single);
-  }
-
   /**
    * List available tokens for this form.
    *