From d90ab52567840852dd6c070a66f2d162e44b45c4 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 30 Sep 2016 06:59:28 +1000 Subject: [PATCH] CRM-19351 Add in missing getFormattedBillingAddressFieldsFromParameters --- CRM/Utils/Address.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index f08e408204..71189daf3d 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -327,4 +327,28 @@ class CRM_Utils_Address { return $newSequence; } + /** + * Extract the billing fields from the form submission and format them for display. + * + * @param array $params + * @param int $billingLocationTypeID + * + * @return string + */ + public static function getFormattedBillingAddressFieldsFromParameters($params, $billingLocationTypeID) { + $addressParts = array( + "street_address" => "billing_street_address-{$billingLocationTypeID}", + "city" => "billing_city-{$billingLocationTypeID}", + "postal_code" => "billing_postal_code-{$billingLocationTypeID}", + "state_province" => "state_province-{$billingLocationTypeID}", + "country" => "country-{$billingLocationTypeID}", + ); + + $addressFields = array(); + foreach ($addressParts as $name => $field) { + $addressFields[$name] = CRM_Utils_Array::value($field, $params); + } + return CRM_Utils_Address::format($addressFields); + } + } -- 2.25.1