CRM-17294 renamed fields not passed to processor
[civicrm-core.git] / CRM / Contribute / Form / Contribution / Confirm.php
index 8a8b270c45fff643fe697fb77591f4602132e367..b367b2f4f556e4cd8cb1e3fb8c774e1e8be58b69 100644 (file)
@@ -1922,22 +1922,16 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
     }
 
-    if (!array_key_exists('first_name', $fields)) {
-      $nameFields = array('first_name', 'middle_name', 'last_name');
-      foreach ($nameFields as $name) {
-        $fields[$name] = 1;
-        if (array_key_exists("billing_$name", $params)) {
-          $params[$name] = $params["billing_{$name}"];
-          $params['preserveDBName'] = TRUE;
-        }
-      }
-    }
+    $fields = $this->formatParamsForPaymentProcessor($fields);
 
     // billing email address
     $fields["email-{$this->_bltID}"] = 1;
 
     //unset the billing parameters if it is pay later mode
     //to avoid creation of billing location
+    // @todo - note that elsewhere we don't unset these - we simply make
+    // a sensible decision about including them when building the form
+    // and if they are submitted we handle them. Check out abstractEditPaymentForm.
     if ($isPayLater && !$this->_isBillingAddressRequiredForPayLater) {
       $billingFields = array(
         'billing_first_name',