From 0b04b86f1e99dde6658ed51b893b148441c26ddb Mon Sep 17 00:00:00 2001 From: Elliott Eggleston Date: Wed, 29 Nov 2017 18:14:48 -0500 Subject: [PATCH] Add API parameter for fix_address Defaults to true, but lets you skip address fixes if desired. --- api/v3/Address.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/v3/Address.php b/api/v3/Address.php index a7ec8cbfcbbd..5ca5acfcbe15 100644 --- a/api/v3/Address.php +++ b/api/v3/Address.php @@ -76,11 +76,15 @@ function civicrm_api3_address_create(&$params) { $params['check_permissions'] = 0; } + if (!isset($params['fix_address'])) { + $params['fix_address'] = TRUE; + } + /** * Create array for BAO (expects address params in as an * element in array 'address' */ - $addressBAO = CRM_Core_BAO_Address::add($params, TRUE); + $addressBAO = CRM_Core_BAO_Address::add($params, $params['fix_address']); if (empty($addressBAO)) { return civicrm_api3_create_error("Address is not created or updated "); } @@ -110,6 +114,12 @@ function _civicrm_api3_address_create_spec(&$params) { at once, the job \'Geocode and Parse Addresses\' can execute this task after the import)', 'type' => CRM_Utils_Type::T_BOOLEAN, ); + $params['fix_address'] = array( + 'title' => ts('Fix address'), + 'description' => ts('When true, apply various fixes to the address before insert. Default true.'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'api.default' => TRUE, + ); $params['world_region'] = array( 'title' => ts('World Region'), 'name' => 'world_region',