From 783f110f3c062b21d134021392375071554286df Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 2 Jun 2022 18:53:31 +1200 Subject: [PATCH] Remove now-unused function --- CRM/Contact/Import/Parser/Contact.php | 67 --------------------------- 1 file changed, 67 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index ed3c7f5233..bd62171231 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1305,73 +1305,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { $this->setImportableFieldsMetadata($this->getContactImportMetadata()); } - /** - * @param array $cids - * @param int $rowNumber - * @param int $onDuplicate - * @param array $formatted - * @param array $contactFields - * - * @return int - * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception - * @throws \Civi\API\Exception\UnauthorizedException - */ - private function handleDuplicateError(array $cids, $rowNumber, int $onDuplicate, array $formatted, array $contactFields): int { - // This is expected to be unreachable. - $urls = []; - - foreach ($cids as $cid) { - $urls[] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $cid, TRUE); - } - - $url_string = implode("\n", $urls); - - // If we duplicate more than one record, skip no matter what - if (count($cids) > 1) { - // Now done in lookup contact - $errorMessage = ts('Record duplicates multiple contacts'); - //combine error msg to avoid mismatch between error file columns. - $errorMessage .= "\n" . $url_string; - $this->setImportStatus($rowNumber, 'ERROR', $errorMessage); - return CRM_Import_Parser::ERROR; - } - - // Params only had one id, so shift it out - $contactId = array_shift($cids); - $cid = NULL; - - $vals = ['contact_id' => $contactId]; - if (in_array((int) $onDuplicate, [CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::DUPLICATE_FILL], TRUE)) { - $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); - } - // else skip does nothing and just returns an error code. - if ($cid) { - $contact = [ - 'contact_id' => $cid, - ]; - $defaults = []; - $newContact = CRM_Contact_BAO_Contact::retrieve($contact, $defaults); - } - - if (is_array($newContact)) { - $contactID = $newContact[0]; - if (!in_array($contactID, $this->_newContacts)) { - $this->_newContacts[] = $contactID; - } - } - //CRM-262 No Duplicate Checking - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) { - $this->setImportStatus($rowNumber, 'DUPLICATE', 'Skipping duplicate record'); - return CRM_Import_Parser::DUPLICATE; - } - - //return warning if street address is not parsed, CRM-5886 - $this->setImportStatus($rowNumber, $this->getStatus(CRM_Import_Parser::VALID), $this->getSuccessMessage(), $contactID); - return CRM_Import_Parser::VALID; - } - /** * Run import. * -- 2.25.1