CRM-13072 test related cleanups - handled getcount on priceset (hackily), simplify...
authoreileen <eileen@fuzion.co.nz>
Sat, 27 Jul 2013 12:04:20 +0000 (00:04 +1200)
committereileen <eileen@fuzion.co.nz>
Sat, 27 Jul 2013 12:04:20 +0000 (00:04 +1200)
api/v3/EntityTag.php
api/v3/Membership.php
api/v3/PriceFieldValue.php
api/v3/PriceSet.php

index 3ea2aaea905bdcf325775e4540cd1a243cef9eb3..1ffe6d5f399a8abfb154e7344a6aad530a94f202 100644 (file)
@@ -80,8 +80,6 @@ function _civicrm_api3_entity_tag_get_spec(&$params) {
  * @example EntityTagCreate.php
  */
 function civicrm_api3_entity_tag_create($params) {
-
-
   return _civicrm_api3_entity_tag_common($params, 'add');
 }
 
index f327649bb7d36d8e355a1d79791c5cffe83ae1cb..1f7f5f54601fff98d732981235af73aeb28efddb 100644 (file)
  * @access public
  */
 function civicrm_api3_membership_delete($params) {
-
-  // membershipID should be numeric
-  // this check should be done @ wrapper level
-  if (!is_numeric($params['id'])) {
-    return civicrm_api3_create_error('Input parameter should be numeric');
-  }
-
-  $membership = new CRM_Member_BAO_Membership();
-  $result = $membership->del($params['id']);
-
-  return $result ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting Membership');
-
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
index f79c825f299647f0229e22683b7590fcfe94c517..684c3cd1623766f98b59380294901e1ac2b4dd3b 100644 (file)
@@ -67,6 +67,7 @@ function civicrm_api3_price_field_value_create($params) {
  * @param array $params array or parameters determined by getfields
  */
 function _civicrm_api3_price_field_value_create_spec(&$params) {
+  $params['price_field_id']['api.required'] = TRUE;
 }
 
 /**
index 19bc3678194bfeb5208b0f1e174cc503acc5d0a7..5423ee048726c1c9f78597c1a1b580c44f053c61 100644 (file)
@@ -84,6 +84,11 @@ function _civicrm_api3_price_set_create_spec(&$params) {
  * @access public
  */
 function civicrm_api3_price_set_get($params) {
+  // hack to make getcount work. - not sure the best approach here
+  // as creating an alternate getcount function also feels a bit hacky
+  if(isset($params['options'])  && isset($params['options']['is_count'])) {
+    return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+  }
   $result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
   // Fetch associated entities
   foreach ($result as &$item) {