From 418e884f3aad6785e23e437df46bc048f8bdac5c Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 28 Jul 2013 00:04:20 +1200 Subject: [PATCH] CRM-13072 test related cleanups - handled getcount on priceset (hackily), simplify membership, whitespace, declare price_field_id as a required field on price_field_value --- api/v3/EntityTag.php | 2 -- api/v3/Membership.php | 13 +------------ api/v3/PriceFieldValue.php | 1 + api/v3/PriceSet.php | 5 +++++ 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 3ea2aaea90..1ffe6d5f39 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -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'); } diff --git a/api/v3/Membership.php b/api/v3/Membership.php index f327649bb7..1f7f5f5460 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -49,18 +49,7 @@ * @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); } /** diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index f79c825f29..684c3cd162 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -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; } /** diff --git a/api/v3/PriceSet.php b/api/v3/PriceSet.php index 19bc367819..5423ee0487 100644 --- a/api/v3/PriceSet.php +++ b/api/v3/PriceSet.php @@ -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) { -- 2.25.1