Merge pull request #3679 from yashodha/CRM-14951
[civicrm-core.git] / api / v3 / RelationshipType.php
index a25ad6716e600d97daec1485aa54933ac42a8b14..8c2f6bad5db664b0c362879ca783ed1f6cad2f2b 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -32,7 +31,7 @@
  *
  * @package CiviCRM_APIv3
  * @subpackage API_Contact
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id: Contact.php 30415 2010-10-29 12:02:47Z shot $
  *
  */
@@ -88,6 +87,7 @@ function _civicrm_api3_relationship_type_create_spec(&$params) {
   $params['contact_type_b']['api.required'] = 1;
   $params['name_a_b']['api.required'] = 1;
   $params['name_b_a']['api.required'] = 1;
+  $params['is_active']['api.default'] = 1;
 }
 
 /**
@@ -98,7 +98,6 @@ function _civicrm_api3_relationship_type_create_spec(&$params) {
  * @example RelationshipTypeGet.php
  */
 function civicrm_api3_relationship_type_get($params) {
-
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
@@ -113,16 +112,6 @@ function civicrm_api3_relationship_type_get($params) {
  * @access public
  */
 function civicrm_api3_relationship_type_delete($params) {
-
-  if ($params['id'] != NULL && !CRM_Utils_Rule::integer($params['id'])) {
-    return civicrm_api3_create_error('Invalid value for relationship type ID');
-  }
-
-  $relationTypeBAO = new CRM_Contact_BAO_RelationshipType();
-  $result = $relationTypeBAO->del($params['id']);
-  if (!$result) {
-    return civicrm_api3_create_error('Could not delete relationship type');
-  }
-  return civicrm_api3_create_success($result, $params, 'relationship_type', 'delete', $relationTypeBAO);
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }