Remove bltID as a parameter from getPaymentProcessorReadyAddressParams
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 21 Dec 2023 20:58:05 +0000 (09:58 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 21 Dec 2023 20:58:05 +0000 (09:58 +1300)
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Core/Form.php

index e97ffe9b3e4ba008fd7582cd7de0c78a1367d620..9c465f9904cb5ee1051963ce9b2d601cf6a25a14 100644 (file)
@@ -429,11 +429,11 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution im
    * To create an address we need state_province_id.
    *
    * @param array $params
-   * @param int $billingLocationTypeID
    *
    * @return array
    */
-  public static function getPaymentProcessorReadyAddressParams($params, $billingLocationTypeID) {
+  public static function getPaymentProcessorReadyAddressParams($params) {
+    $billingLocationTypeID = CRM_Core_BAO_LocationType::getBilling();
     [$hasBillingField, $addressParams] = self::getBillingAddressParams($params, $billingLocationTypeID);
     foreach ($addressParams as $name => $field) {
       if (substr($name, 0, 8) == 'billing_') {
index 4d2e87b2aedec45648c5e5dace4989c660532cc0..3c9e1f641bb9c528a6f2883ec00655ab60af8f7f 100644 (file)
@@ -554,15 +554,15 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task {
     foreach (array_keys($this->_fields) as $name) {
       $fields[$name] = 1;
     }
-
-    $fields["address_name-{$this->_bltID}"] = 1;
+    $billingLocationID = CRM_Core_BAO_LocationType::getBilling();
+    $fields["address_name-{$billingLocationID}"] = 1;
 
     //ensure we don't over-write the payer's email with the member's email
     if ($contactID == $this->_contactID) {
-      $fields["email-{$this->_bltID}"] = 1;
+      $fields["email-{$billingLocationID}"] = 1;
     }
 
-    [$hasBillingField, $addressParams] = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
+    [$hasBillingField, $addressParams] = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params);
     $fields = $this->formatParamsForPaymentProcessor($fields);
 
     if ($hasBillingField) {
index 6cab90d98504a9e9e40c52781b4308fcb0985ec0..5e274dc66646a660d0d1a5fd06673f2506b4c3e3 100644 (file)
@@ -1016,7 +1016,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $params['country'] = $params["country-$billingLocationID"] = $params["billing_country-$billingLocationID"] = CRM_Core_PseudoConstant::countryIsoCode($params["billing_country_id-$billingLocationID"]);
     }
 
-    [$hasAddressField, $addressParams] = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($params, $this->_bltID);
+    [$hasAddressField, $addressParams] = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($params);
     if ($hasAddressField) {
       $params = array_merge($params, $addressParams);
     }