CRM-14446 contact.get api tests + fix on date filters
[civicrm-core.git] / api / v3 / RelationshipType.php
index 291415b89f31cc5fcce60e2a0cc6ac9e266ff508..3c8b7eca600afbbd8046dee24f508d97c2d8bb03 100644 (file)
@@ -1,9 +1,7 @@
 <?php
-// $Id$
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
  *
  */
 
-/**
- * Include common API util functions
- */
-require_once 'CRM/Contact/BAO/RelationshipType.php';
-
 /**
  * Function to create relationship type
  *
@@ -65,8 +58,6 @@ function civicrm_api3_relationship_type_create($params) {
     $params['label_b_a'] = $params['name_b_a'];
   }
 
-  require_once 'CRM/Utils/Rule.php';
-
   $ids = array();
   if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
     return civicrm_api3_create_error('Invalid value for relationship type ID');
@@ -87,7 +78,7 @@ function civicrm_api3_relationship_type_create($params) {
 
 /**
  * Adjust Metadata for Create action
- * 
+ *
  * The metadata is used for setting defaults, documentation & validation
  * @param array $params array or parameters determined by getfields
  */
@@ -106,7 +97,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);
 }
 
@@ -121,17 +111,6 @@ function civicrm_api3_relationship_type_get($params) {
  * @access public
  */
 function civicrm_api3_relationship_type_delete($params) {
-
-  require_once 'CRM/Utils/Rule.php';
-  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);
 }