Fix unnecessary required param in contact BAO create
authorColeman Watts <coleman@civicrm.org>
Wed, 17 Apr 2019 00:45:36 +0000 (20:45 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 17 Apr 2019 21:00:03 +0000 (17:00 -0400)
Normally a BAO should require an id and nothing else for an update op
But the contact BAO required contact_type for no good reason.

CRM/Contact/BAO/Contact.php

index f1fb6929d82ea39bbe3ff8818f790d080fecfe17..4d5e276efa31194b03dffe7b3ffb33c588ccc8a0 100644 (file)
@@ -272,6 +272,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
       return $contact;
     }
 
+    if (!empty($params['contact_id']) && empty($params['contact_type'])) {
+      $params['contact_type'] = self::getContactType($params['contact_id']);
+    }
+
     $isEdit = TRUE;
     if ($invokeHooks) {
       if (!empty($params['contact_id'])) {