diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 92beaa9dac29..f670fa1e6292 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -370,8 +370,6 @@ public function getAllFields() { * @param array $values * The array of values belonging to this line. * - * @param bool $doGeocodeAddress - * * @return bool * the result of this processing * @@ -379,9 +377,9 @@ public function getAllFields() { * @throws \CRM_Core_Exception * @throws \API_Exception */ - public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) { + public function import($onDuplicate, &$values) { $this->_unparsedStreetAddressContacts = []; - if (!$doGeocodeAddress) { + if (!$this->getSubmittedValue('doGeocodeAddress')) { // CRM-5854, reset the geocode method to null to prevent geocoding CRM_Utils_GeocodeProvider::disableForSession(); } @@ -2446,12 +2444,9 @@ public function deprecated_contact_check_params( * @param int $onDuplicate * @param int $statusID * @param int $totalRowCount - * @param bool $doGeocodeAddress - * @param int $timeout - * @param string $contactSubType - * @param int $dedupeRuleGroupID * * @return mixed + * @throws \API_Exception */ public function run( $tableName, @@ -2462,16 +2457,12 @@ public function run( $statusFieldName = '_status', $onDuplicate = self::DUPLICATE_SKIP, $statusID = NULL, - $totalRowCount = NULL, - $doGeocodeAddress = FALSE, - $timeout = CRM_Contact_Import_Parser_Contact::DEFAULT_TIMEOUT, - $contactSubType = NULL, - $dedupeRuleGroupID = NULL + $totalRowCount = NULL ) { // TODO: Make the timeout actually work - $this->_onDuplicate = $onDuplicate; - $this->_dedupeRuleGroupID = $dedupeRuleGroupID; + $this->_onDuplicate = $onDuplicate = $this->getSubmittedValue('onDuplicate'); + $this->_dedupeRuleGroupID = $this->getSubmittedValue('dedupe_rule_id'); // Since $this->_contactType is still being called directly do a get call // here to make sure it is instantiated. $this->getContactType(); @@ -2544,7 +2535,7 @@ public function run( } elseif ($mode == self::MODE_IMPORT) { try { - $returnCode = $this->import($onDuplicate, $values, $doGeocodeAddress); + $returnCode = $this->import($onDuplicate, $values); } catch (CiviCRM_API3_Exception $e) { // When we catch errors here we are not adding to the errors array - mostly diff --git a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php index 4e2ec24ac91a..6766156045ea 100644 --- a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php +++ b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php @@ -149,6 +149,7 @@ public function getMapFieldFormObject(array $submittedValues = []): CRM_Contact_ 'contactSubType' => '', 'dataSource' => 'CRM_Import_DataSource_SQL', 'sqlQuery' => 'SELECT * FROM civicrm_tmp_d_import_job_xxx', + 'dedupe_rule_id' => '', 'onDuplicate' => CRM_Import_Parser::DUPLICATE_UPDATE, ], $submittedValues); $userJobID = UserJob::create()->setValues([ diff --git a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php index c6229cd2ab2b..ed5b6b18d20e 100644 --- a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php +++ b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php @@ -1059,6 +1059,7 @@ protected function getUserJobID($submittedValues = []) { 'submitted_values' => array_merge([ 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL, 'contactSubType' => '', + 'doGeocodeAddress' => 0, ], $submittedValues), ], 'status_id:name' => 'draft',