From f6953904aa456ffafeb0c18a99106ebf5f27449b Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 24 Apr 2019 15:33:56 +1200 Subject: [PATCH] Follow up tidy up on import - use same fn for address This is covered by testImportPrimaryAddressUpdate --- CRM/Contact/Import/Parser.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/CRM/Contact/Import/Parser.php b/CRM/Contact/Import/Parser.php index a98a4f2d3e..c9d41c2cb1 100644 --- a/CRM/Contact/Import/Parser.php +++ b/CRM/Contact/Import/Parser.php @@ -1314,20 +1314,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { } } - if ($values['location_type_id'] === 'Primary') { - if (!empty($params['id'])) { - $primary = civicrm_api3('Address', 'get', [ - 'return' => 'location_type_id', - 'contact_id' => $params['id'], - 'is_primary' => 1, - 'sequential' => 1 - ]); - } - $defaultLocationType = CRM_Core_BAO_LocationType::getDefault(); - $params['address'][$values['location_type_id']]['location_type_id'] = (isset($primary) && $primary['count']) ? $primary['values'][0]['location_type_id'] : $defaultLocationType->id; - $params['address'][$values['location_type_id']]['is_primary'] = 1; - - } + $this->fillPrimary($params['address'][$values['location_type_id']], $values, 'address', CRM_Utils_Array::value('id', $params)); return TRUE; } -- 2.25.1