// We may have fetched some billing details from the getPreApprovalDetails function so we
// want to ensure we set this after that function has been called.
CRM_Core_Payment_Form::mapParams($this->_bltID, $this->_params, $this->_params, FALSE);
- if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
- $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
- }
- if (!empty($this->_params["billing_country_id-{$this->_bltID}"])) {
- $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
- }
$this->_params['is_pay_later'] = $this->get('is_pay_later');
$this->assign('is_pay_later', $this->_params['is_pay_later']);
* @param bool $reverse
*/
public static function mapParams($id, $src, &$dst, $reverse = FALSE) {
- static $map = NULL;
- if (!$map) {
- $map = array(
- 'first_name' => 'billing_first_name',
- 'middle_name' => 'billing_middle_name',
- 'last_name' => 'billing_last_name',
- 'email' => "email-$id",
- 'street_address' => "billing_street_address-$id",
- 'supplemental_address_1' => "billing_supplemental_address_1-$id",
- 'city' => "billing_city-$id",
- 'state_province' => "billing_state_province-$id",
- 'postal_code' => "billing_postal_code-$id",
- 'country' => "billing_country-$id",
- 'contactID' => 'contact_id',
- );
+ // Set text version of state & country if present.
+ if (isset($src["billing_state_province_id-{$id}"])) {
+ $src["billing_state_province-{$id}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation ($src["billing_state_province_id-{$id}"]);
}
+ if (isset($src["billing_country_id-{$id}"])) {
+ $src["billing_country-{$id}"] = CRM_Core_PseudoConstant::countryIsoCode($src["billing_country_id-{$id}"]);;
+ };
+ $map = array(
+ 'first_name' => 'billing_first_name',
+ 'middle_name' => 'billing_middle_name',
+ 'last_name' => 'billing_last_name',
+ 'email' => "email-$id",
+ 'street_address' => "billing_street_address-$id",
+ 'supplemental_address_1' => "billing_supplemental_address_1-$id",
+ 'city' => "billing_city-$id",
+ 'state_province' => "billing_state_province-$id",
+ 'postal_code' => "billing_postal_code-$id",
+ 'country' => "billing_country-$id",
+ 'contactID' => 'contact_id',
+ );
foreach ($map as $n => $v) {
if (!$reverse) {
$preApprovalParams = $this->_paymentProcessor['object']->getPreApprovalDetails($this->get('pre_approval_parameters'));
$params = array_merge($this->_params, $preApprovalParams);
}
-
CRM_Core_Payment_Form::mapParams($this->_bltID, $params, $params, FALSE);
- // fix state and country id if present
- // @todo - this is duplicated further down.
- if (isset($params["billing_state_province_id-{$this->_bltID}"])) {
- $params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($params["billing_state_province_id-{$this->_bltID}"]);
- }
- if (isset($params['billing_country_id'])) {
- $params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($params["billing_country_id-{$this->_bltID}"]);
- }
-
// set a few other parameters that are not really specific to this method because we don't know what
// will break if we change this.
$params['amount'] = $this->_params[0]['amount'];
CRM_Event_Form_Registration_Confirm::fixLocationFields($value, $fields, $this);
//unset the billing parameters if it is pay later mode
//to avoid creation of billing location
+ // @todo - the reasoning for this is unclear - elsewhere we check what fields are provided by
+ // the form & if billing fields exist we create the address, relying on the form to collect
+ // only information we intend to store.
if ($this->_allowWaitlist
|| $this->_requireApproval
|| (!empty($value['is_pay_later']) && !$this->_isBillingAddressRequiredForPayLater)