Merge pull request #23509 from eileenmcnaughton/import_except
authorcolemanw <coleman@civicrm.org>
Fri, 20 May 2022 23:32:05 +0000 (19:32 -0400)
committerGitHub <noreply@github.com>
Fri, 20 May 2022 23:32:05 +0000 (19:32 -0400)
[Import] Remove handling for unavailable field current_employer

1  2 
CRM/Contact/Import/Parser/Contact.php

index 1d66be5885ba915b14da19a8a180c7c36bee7983,ef854c573b25a6f519cbe64cbe493ab8258da50b..7e18353645b530a22a3a90c1139681ece0722193
@@@ -1979,37 -2048,14 +1979,19 @@@ class CRM_Contact_Import_Parser_Contac
        // $dupes = civicrm_api3('Contact', 'duplicatecheck', (array('match' => $params, 'dedupe_rule_id' => $dedupeRuleGroupID)));
        // $ids = $dupes['count'] ? implode(',', array_keys($dupes['values'])) : NULL;
        $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $params['contact_type'], 'Unsupervised', [], CRM_Utils_Array::value('check_permissions', $params), $dedupeRuleGroupID);
 +
        if ($ids != NULL) {
 -        $error = CRM_Core_Error::createError("Found matching contacts: " . implode(',', $ids),
 -          CRM_Core_Error::DUPLICATE_CONTACT,
 -          'Fatal', $ids
 -        );
 -        return civicrm_api3_create_error($error->pop());
 +        return [
 +          'is_error' => 1,
 +          'error_message' => [
 +            'code' => CRM_Core_Error::DUPLICATE_CONTACT,
 +            'params' => $ids,
 +            'level' => 'Fatal',
 +            'message' => 'Found matching contacts: ' . implode(',', $ids),
 +          ],
 +        ];
        }
      }
-     // check for organisations with same name
-     if (!empty($params['current_employer'])) {
-       $organizationParams = ['organization_name' => $params['current_employer']];
-       $dupeIds = CRM_Contact_BAO_Contact::getDuplicateContacts($organizationParams, 'Organization', 'Supervised', [], FALSE);
-       // check for mismatch employer name and id
-       if (!empty($params['employer_id']) && !in_array($params['employer_id'], $dupeIds)
-       ) {
-         throw new CRM_Core_Exception('Employer name and Employer id Mismatch');
-       }
-       // show error if multiple organisation with same name exist
-       if (empty($params['employer_id']) && (count($dupeIds) > 1)
-       ) {
-         return civicrm_api3_create_error('Found more than one Organisation with same Name.');
-       }
-     }
    }
  
    /**