diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 523924c4c405..f1b7b92b0e96 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -420,12 +420,7 @@ private function formatCommonData($params, &$formatted) { if ((strtolower($v2['label']) == strtolower(trim($v1))) || (strtolower($v2['value']) == strtolower(trim($v1))) ) { - if ($htmlType == 'CheckBox') { - $params[$key][$v2['value']] = $formatted[$key][$v2['value']] = 1; - } - else { - $params[$key][] = $formatted[$key][] = $v2['value']; - } + $params[$key][] = $formatted[$key][] = $v2['value']; } } } diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 9b909411f064..6ad0e41dddf9 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -2548,16 +2548,20 @@ protected function getDedupeRules(array $dedupeRuleIDs, $contact_type) { /** * @param array|null $row + * + * @return bool */ - public function validateRow(?array $row): void { + public function validateRow(?array $row): bool { try { $rowNumber = $row['_id']; $values = array_values($row); $this->validateValues($values); $this->setImportStatus($rowNumber, 'VALID', ''); + return TRUE; } catch (CRM_Core_Exception $e) { $this->setImportStatus($rowNumber, 'ERROR', $e->getMessage()); + return FALSE; } } diff --git a/ext/civiimport/Civi/Api4/Import/Import.php b/ext/civiimport/Civi/Api4/Import/Import.php index 60099303bd80..4a152d255faa 100644 --- a/ext/civiimport/Civi/Api4/Import/Import.php +++ b/ext/civiimport/Civi/Api4/Import/Import.php @@ -25,10 +25,12 @@ class Import extends DAOGetAction { public function _run(Result $result): void { $userJobID = (int) str_replace('Import_', '', $this->_entityName); $where = $this->where; - $this->addWhere('_status', 'IN', ['new', 'valid']); $this->getImportRows($result); $parser = $this->getParser($userJobID); foreach ($result as $row) { + if (!in_array($row['_status'], ['new', 'valid'], TRUE) && !$parser->validateRow($row)) { + continue; + } $parser->import(array_values($row)); } $parser->doPostImportActions(); diff --git a/ext/civiimport/Civi/Api4/Import/ImportProcessTrait.php b/ext/civiimport/Civi/Api4/Import/ImportProcessTrait.php index c60a4d5b4e21..71f91e7ffd16 100644 --- a/ext/civiimport/Civi/Api4/Import/ImportProcessTrait.php +++ b/ext/civiimport/Civi/Api4/Import/ImportProcessTrait.php @@ -66,6 +66,7 @@ protected function getImportRows(Result $result): void { ->indexBy('name')); $importFields[] = '_id'; $importFields[] = '_entity_id'; + $importFields[] = '_status'; $this->setSelect($importFields); parent::_run($result); foreach ($result as &$row) {