Wrap membership receipt in an outer function.
authoreileen <emcnaughton@wikimedia.org>
Mon, 20 Aug 2018 05:05:12 +0000 (17:05 +1200)
committereileen <emcnaughton@wikimedia.org>
Wed, 10 Oct 2018 13:36:29 +0000 (14:36 +0100)
This function is neither static nor shared & we work to replace the
other / put the parts that really are shared somewhere sensible

CRM/Member/Form/Membership.php

index ee1c8467dafc2dc9e978fbe197f8ee3f92e59bb6..59b5709f96289b27c873938a9f80e027d61d4c54 100644 (file)
@@ -974,6 +974,10 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
   /**
    * Send email receipt.
    *
+   * @deprecated
+   *   This function is shared with Batch_Entry which has limited overlap
+   *   & needs rationalising.
+   *
    * @param CRM_Core_Form $form
    *   Form object.
    * @param array $formValues
@@ -1728,7 +1732,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       $formValues['receipt_text_signup'] = $formValues['receipt_text'];
       // send email receipt
       $this->assignBillingName();
-      $mailSend = self::emailReceipt($this, $formValues, $membership);
+      $mailSend = $this->emailMembershipReceipt();
       $receiptSent = TRUE;
     }
 
@@ -1967,4 +1971,16 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     return $isRecur;
   }
 
+  /**
+   * Send a receipt for the membership.
+   *
+   * @param array $formValues
+   * @param array $membership
+   * @return array
+   */
+  protected function emailMembershipReceipt($formValues, $membership) {
+    $mailSend = self::emailReceipt($this, $formValues, $membership);
+    return [$membership, $mailSend];
+  }
+
 }