Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.3.0
-
Fix Version/s: 4.3.0
-
Component/s: None
-
Labels:None
Description
Turning on e-Notice on CustomGroup test reveals code to create an option group with fields - however the test that purports to test this doesn't test the field creation & I can't see how the code could be useful as it doesn't pass through the params relevant to creating the custom fields
My take on it is this is API v2 left-overs & the code should go - but would appreciate a second pair of eyes
Index: api/v3/CustomGroup.php
===================================================================
— api/v3/CustomGroup.php (revision 45635)
+++ api/v3/CustomGroup.php (working copy)
@@ -37,9 +37,6 @@
- @version $Id: CustomGroup.php 30879 2010-11-22 15:45:55Z shot $
*/
-
-require_once 'CRM/Core/BAO/CustomGroup.php';
-
/**
- Most API functions take in associative arrays ( name => value pairs
- as parameters. Some of the most commonly used parameters are
@@ -64,7 +61,6 @@
* - @return Newly create custom_group object
- @todo $params['extends'] is array format - is that std compatible
- * @todo review custom field create if 'html' approx line 110
- @access public
*/
function civicrm_api3_custom_group_create($params) {
@@ -85,24 +81,12 @@
$customGroup = CRM_Core_BAO_CustomGroup::create($params);
_civicrm_api3_object_to_array($customGroup, $values[$customGroup->id]);
-
- if (CRM_Utils_Array::value('html_type', $params))
{
- $fparams = array(
- 'custom_group_id' => $customGroup->id,
- 'version' => $params['version'],
- // should put something cleverer here but this will do for now
- 'label' => 'api created field',
- );
- require_once 'api/v3/CustomField.php';
- $fieldValues = civicrm_api3_custom_field_create($fparams);
- $values[$fieldValues['id']] = array_merge($values[$customGroup->id], $fieldValues['values'][$fieldValues['id']]);
- }
return civicrm_api3_create_success($values, $params, 'custom_group', $customGroup);
}