[REF] Remove handling for non-existent 'savedMapping' field
[civicrm-core.git] / CRM / Utils / DeprecatedUtils.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /*
19 * These functions have been deprecated out of API v3 Utils folder as they are not part of the
20 * API. Calling API functions directly is not supported & these functions are not called by any
21 * part of the API so are not really part of the api
22 *
23 */
24
25 require_once 'api/v3/utils.php';
26
27 /**
28 *
29 * @param array $params
30 *
31 * @return array
32 * <type>
33 */
34 function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
35 $id = $params['id'] ?? NULL;
36 $externalId = $params['external_identifier'] ?? NULL;
37 if ($id || $externalId) {
38 $contact = new CRM_Contact_DAO_Contact();
39
40 $contact->id = $id;
41 $contact->external_identifier = $externalId;
42
43 if ($contact->find(TRUE)) {
44 if ($params['contact_type'] != $contact->contact_type) {
45 return civicrm_api3_create_error("Mismatched contact IDs OR Mismatched contact Types");
46 }
47
48 $error = CRM_Core_Error::createError("Found matching contacts: $contact->id",
49 CRM_Core_Error::DUPLICATE_CONTACT,
50 'Fatal', $contact->id
51 );
52 return civicrm_api3_create_error($error->pop());
53 }
54 }
55 else {
56 $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $params['contact_type'], 'Unsupervised');
57
58 if (!empty($ids)) {
59 $ids = implode(',', $ids);
60 $error = CRM_Core_Error::createError("Found matching contacts: $ids",
61 CRM_Core_Error::DUPLICATE_CONTACT,
62 'Fatal', $ids
63 );
64 return civicrm_api3_create_error($error->pop());
65 }
66 }
67 return civicrm_api3_create_success(TRUE);
68 }