X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FContact.php;h=237d170cfac78e54757e87f9513c32256af94e98;hb=6c2325761de52ec8e6381a96f40bc183fd19851f;hp=8217b646d1a2630fae44249574ee63ce9ff65b2c;hpb=5fbba0ef4e8d7bcbb912e3147205e9542ffee33b;p=civicrm-core.git diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 8217b646d1..237d170cfa 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -1228,7 +1228,7 @@ function civicrm_api3_contact_get_merge_conflicts($params) { foreach ((array) $params['mode'] as $mode) { $result[$mode] = CRM_Dedupe_Merger::getConflicts( $migrationInfo, - $params['to_remove_id'], $params['to_keep_id'], + (int) $params['to_remove_id'], (int) $params['to_keep_id'], $mode ); } @@ -1602,10 +1602,16 @@ function _civicrm_api3_contact_getlist_output($result, $request) { * @throws \CiviCRM_API3_Exception */ function civicrm_api3_contact_duplicatecheck($params) { + if (!isset($params['match']) || !is_array($params['match'])) { + throw new \CiviCRM_API3_Exception('Duplicate check must include criteria to check against (missing or invalid $params[\'match\']).'); + } + if (!isset($params['match']['contact_type']) || !is_string($params['match']['contact_type'])) { + throw new \CiviCRM_API3_Exception('Duplicate check must include a contact type. (missing or invalid $params[\'match\'][\'contact_type\'])'); + } $dupes = CRM_Contact_BAO_Contact::getDuplicateContacts( $params['match'], $params['match']['contact_type'], - $params['rule_type'], + $params['rule_type'] ?? '', CRM_Utils_Array::value('exclude', $params, []), CRM_Utils_Array::value('check_permissions', $params), CRM_Utils_Array::value('dedupe_rule_id', $params)