Skip to content

Commit

Permalink
Add API parameter for fix_address
Browse files Browse the repository at this point in the history
Change-Id: I4b59b1b1518b8f7ed24804a001d9d0fb31381b79
  • Loading branch information
ejegg committed Dec 5, 2017
1 parent d08c994 commit 17a1438
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/v3/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");
}
Expand Down Expand Up @@ -110,6 +114,11 @@ 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' => 'Fix address',
'description' => 'When true, apply various fixes to the address before insert. Default true.',
'type' => CRM_Utils_Type::T_BOOLEAN,
);
$params['world_region'] = array(
'title' => ts('World Region'),
'name' => 'world_region',
Expand Down

0 comments on commit 17a1438

Please sign in to comment.