*
* @return object
*/
- static function add(&$params, &$ids) {
+ static function add(&$params, $ids = array()) {
$fields = array('is_active', 'add_captcha', 'is_map', 'is_update_dupe', 'is_edit_link', 'is_uf_link', 'is_cms_user');
foreach ($fields as $field) {
$params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->copyValues($params);
- $ufGroupID = CRM_Utils_Array::value('ufgroup', $ids);
+ $ufGroupID = CRM_Utils_Array::value('ufgroup', $ids, CRM_Utils_Array::value('id', $params));
if (!$ufGroupID) {
$ufGroup->name = CRM_Utils_String::munge($ufGroup->title, '_', 56);
}
) as $suppress) {
unset($contributionStatuses[CRM_Utils_Array::key($suppress, $statusName)]);
}
-
+
$form->add('select', $name, $title,
array(
'' => ts('- select -')) + $contributionStatuses, $required
* @access public
*/
function civicrm_api3_uf_group_create($params) {
-
- $ids = array();
- $ids['ufgroup'] = $params['id'];
-
-
- $ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
- _civicrm_api3_object_to_array($ufGroup, $ufGroupArray[$ufGroup->id]);
-
- return civicrm_api3_create_success($ufGroupArray, $params);
+ return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
protected $_contactId = 69;
protected $_apiversion;
protected $params;
+ public $_eNoticeCompliant = TRUE;
protected function setUp() {
parent::setUp();
$result = civicrm_api('uf_group', 'create', $this->params);
$this->documentMe($this->params, $result, __FUNCTION__, __FILE__);
-
+ $this->assertAPISuccess($result);
$this->assertEquals($result['values'][$result['id']]['add_to_group_id'], $this->params['add_contact_to_group'], 'in line ' . __LINE__);
$this->assertEquals($result['values'][$result['id']]['limit_listings_group_id'], $this->params['group'], 'in line ' . __LINE__);
$this->params['created_date'] = date('YmdHis', strtotime($this->params['created_date']));
function testUFGroupDelete() {
$ufGroup = civicrm_api('uf_group', 'create', $this->params);
+ $this->assertAPISuccess($ufGroup);
$params = array('version' => $this->_apiversion, 'id' => $ufGroup['id']);
$this->assertEquals(1, civicrm_api('uf_group', 'getcount', $params), "in line " . __LINE__);
$result = civicrm_api('uf_group', 'delete', $params, "in line " . __LINE__);