Revert places where setters are used to set things
[civicrm-core.git] / api / v3 / Phone.php
index 0ce79c13697a83bd9a1c76ee5c73fc0207049e87..e5a4513d4b58bed1f50d96324265a606b854173c 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -56,6 +56,10 @@ function _civicrm_api3_phone_create_spec(&$params) {
   $params['phone']['api.required'] = 1;
   // hopefully change to use handleprimary
   $params['is_primary']['api.default'] = 0;
+  $defaultLocation = CRM_Core_BAO_LocationType::getDefault();
+  if ($defaultLocation) {
+    $params['location_type_id']['api.default'] = $defaultLocation->id;
+  }
 }
 
 /**