Add default location for API v3 creates of Address, IM, OpenID and Phone.
[civicrm-core.git] / api / v3 / Im.php
index aaabb5d5450d8b109904356787325d27442f11f6..711db2e57e76a645e0ff502f9cb3763df377f260 100644 (file)
@@ -52,6 +52,10 @@ function civicrm_api3_im_create($params) {
  */
 function _civicrm_api3_im_create_spec(&$params) {
   $params['contact_id']['api.required'] = 1;
+  $defaultLocation = CRM_Core_BAO_LocationType::getDefault();
+  if ($defaultLocation) {
+    $params['location_type_id']['api.default'] = $defaultLocation->id;
+  }
 }
 
 /**