[REF] Move code that relates to receipts when paying by credit card out of the shared...
authoreileen <emcnaughton@wikimedia.org>
Tue, 23 Feb 2021 01:16:46 +0000 (14:16 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 23 Feb 2021 01:17:20 +0000 (14:17 +1300)
The emailReceipt function is shared between the Batch Entry form and the backoffice
credit card form, while the emailMembershipReceipt is only used in this function.

I aim to copy the function onto the Batch Entry form & split them up but
am first moving this out of the shared code as it only
relates to credit card payments, which are not reachable from the Batch Entry form

CRM/Member/Form/Membership.php

index 185c5991c7c6f0cc46c7403854964758f347bdda..1112bb3337967d26fca1453f46f1704fd9d06846 100644 (file)
@@ -917,19 +917,6 @@ DESC limit 1");
       $formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']];
     }
 
-    if ($form->_mode) {
-      // @todo move this outside shared code as Batch entry just doesn't
-      $form->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters(
-        $form->_params,
-        $form->_bltID
-      ));
-
-      $valuesForForm = CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($form->_params);
-      $form->assignVariables($valuesForForm, ['credit_card_exp_date', 'credit_card_type', 'credit_card_number']);
-      $form->assign('is_pay_later', 0);
-      $form->assign('isPrimary', 1);
-    }
-
     $form->assign('module', 'Membership');
     $form->assign('contactID', $formValues['contact_id']);
 
@@ -1765,6 +1752,18 @@ DESC limit 1");
     $customValues = $this->getCustomValuesForReceipt($formValues, $membership);
     $this->assign('customValues', $customValues);
 
+    if ($this->_mode) {
+      // @todo move this outside shared code as Batch entry just doesn't
+      $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters(
+        $this->_params,
+        $this->_bltID
+      ));
+
+      $valuesForForm = CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($this->_params);
+      $this->assignVariables($valuesForForm, ['credit_card_exp_date', 'credit_card_type', 'credit_card_number']);
+      $this->assign('is_pay_later', 0);
+      $this->assign('isPrimary', 1);
+    }
     return self::emailReceipt($this, $formValues, $membership);
   }