Merge pull request #16496 from mattwire/billingsamecheckboxchange
[civicrm-core.git] / api / v3 / Contact.php
index 680583cf1e78bba3edd7d110f7595d03158714db..d79910a4c73282781d66fb23f9973fed9aa7c80f 100644 (file)
@@ -81,6 +81,9 @@ function civicrm_api3_contact_create($params) {
 
   if (empty($params['contact_type']) && $contactID) {
     $params['contact_type'] = CRM_Contact_BAO_Contact::getContactType($contactID);
+    if (!$params['contact_type']) {
+      throw new API_Exception('Contact id ' . $contactID . ' not found.');
+    }
   }
 
   if (!isset($params['contact_sub_type']) && $contactID) {
@@ -855,7 +858,7 @@ function civicrm_api3_contact_getquick($params) {
   }
   $actualSelectElements = implode(', ', $actualSelectElements);
   $from = implode(' ', $from);
-  $limit = (int) CRM_Utils_Array::value('limit', $params);
+  $limit = (int) ($params['limit'] ?? 0);
   $limit = $limit > 0 ? $limit : Civi::settings()->get('search_autocomplete_count');
 
   // add acl clause here
@@ -1589,9 +1592,9 @@ function civicrm_api3_contact_duplicatecheck($params) {
     return civicrm_api3('Contact', 'get', [
       'return' => $params['return'],
       'id' => ['IN' => $dupes],
-      'options' => CRM_Utils_Array::value('options', $params),
-      'sequential' => CRM_Utils_Array::value('sequential', $params),
-      'check_permissions' => CRM_Utils_Array::value('check_permissions', $params),
+      'options' => $params['options'] ?? NULL,
+      'sequential' => $params['sequential'] ?? NULL,
+      'check_permissions' => $params['check_permissions'] ?? NULL,
     ]);
   }
   foreach ($dupes as $dupe) {