From 2c59f0cab13b1c2bcd3d60ee350a03fa3bff0b07 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 14 Jun 2019 07:46:00 -0400 Subject: [PATCH] Address BAO - Handle standard 'custom' param as well as individual fields The Address BAO was an oddball in that it took raw unformatted custom field input and processed it. Other BAOs expect the custom field input to alreay be processed. This allows it to handle either format. --- CRM/Core/BAO/Address.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index cbe0066dec..71ebf132db 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -162,15 +162,20 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { $address->save(); if ($address->id) { - $customFields = CRM_Core_BAO_CustomField::getFields('Address', FALSE, TRUE, NULL, NULL, FALSE, FALSE, $checkPermissions); - - if (!empty($customFields)) { - $addressCustom = CRM_Core_BAO_CustomField::postProcess($params, - $address->id, - 'Address', - FALSE, - $checkPermissions - ); + if (isset($params['custom'])) { + $addressCustom = $params['custom']; + } + else { + $customFields = CRM_Core_BAO_CustomField::getFields('Address', FALSE, TRUE, NULL, NULL, FALSE, FALSE, $checkPermissions); + + if (!empty($customFields)) { + $addressCustom = CRM_Core_BAO_CustomField::postProcess($params, + $address->id, + 'Address', + FALSE, + $checkPermissions + ); + } } if (!empty($addressCustom)) { CRM_Core_BAO_CustomValueTable::store($addressCustom, 'civicrm_address', $address->id); -- 2.25.1