$form->assign('paymentTypeLabel', self::getPaymentLabel($processor['object']));
$form->assign('isBackOffice', $isBackOffice);
$form->_paymentFields = self::getPaymentFieldMetadata($processor);
- $form->_paymentFields = array_merge($form->_paymentFields, self::getBillingAddressMetadata($processor, $form->_bltID));
+ $form->_paymentFields = array_merge($form->_paymentFields, self::getBillingAddressMetadata($processor));
$form->assign('paymentFields', self::getPaymentFields($processor));
self::setBillingAddressFields($form, $processor);
}
* @param CRM_Core_Payment $processor
*/
protected static function setBillingAddressFields(&$form, $processor) {
- $billingID = $form->_bltID;
+ $billingID = CRM_Core_BAO_LocationType::getBilling();
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('billingDetailsFields', self::getBillingAddressFields($processor, $billingID));
}
* Get the billing fields that apply to this processor.
*
* @param array $paymentProcessor
- * @param int $billingLocationID
- * ID of billing location type.
*
* @todo sometimes things like the country alter the required fields (e.g postal code). We should possibly
* set these before calling getPaymentFormFields (as we identify them).
*
* @return array
*/
- public static function getBillingAddressFields($paymentProcessor, $billingLocationID) {
+ public static function getBillingAddressFields($paymentProcessor) {
+ $billingLocationID = CRM_Core_BAO_LocationType::getBilling();
return $paymentProcessor['object']->getBillingAddressFields($billingLocationID);
}
/**
* @param array $paymentProcessor
*
- * @param int $billingLocationID
- *
* @return array
* @throws \CRM_Core_Exception
*/
- public static function getBillingAddressMetadata($paymentProcessor, $billingLocationID) {
+ public static function getBillingAddressMetadata($paymentProcessor) {
+ $billingLocationID = CRM_Core_BAO_LocationType::getBilling();
$paymentProcessorObject = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
return array_intersect_key(
$paymentProcessorObject->getBillingAddressFieldsMetadata($billingLocationID),
public static function setDefaultValues(&$form, $contactID) {
$billingDefaults = $form->getProfileDefaults('Billing', $contactID);
$form->_defaults = array_merge($form->_defaults, $billingDefaults);
-
+ $billingLocationID = CRM_Core_BAO_LocationType::getBilling();
// set default country & state from config if no country set
// note the effect of this is to set the billing country to default to the site default
// country if the person has an address but no country (for anonymous country is set above)
// this could have implications if the billing profile is filled but hidden.
// this behaviour has been in place for a while but the use of js to hide things has increased
- if (empty($form->_defaults["billing_country_id-{$form->_bltID}"])) {
- $form->_defaults["billing_country_id-{$form->_bltID}"] = CRM_Core_Config::singleton()->defaultContactCountry;
+ if (empty($form->_defaults["billing_country_id-{$billingLocationID}"])) {
+ $form->_defaults["billing_country_id-{$billingLocationID}"] = CRM_Core_Config::singleton()->defaultContactCountry;
}
- if (empty($form->_defaults["billing_state_province_id-{$form->_bltID}"])) {
- $form->_defaults["billing_state_province_id-{$form->_bltID}"] = CRM_Core_Config::singleton()
+ if (empty($form->_defaults["billing_state_province_id-{$billingLocationID}"])) {
+ $form->_defaults["billing_state_province_id-{$billingLocationID}"] = CRM_Core_Config::singleton()
->defaultContactStateProvince;
}
}