throw new CRM_Core_Exception('Invalid Entity Filter');
}
$subTypes = civicrm_api3('Contact', 'getoptions', array('field' => 'contact_sub_type'));
- if (!in_array($subType, $subTypes['values'])) {
+ if (!isset($subTypes['values'][$subType])) {
// Same comments about fail hard as above.
throw new CRM_Core_Exception('Invalid Filter');
}
* inconsistency.
*/
public function testGetTreeContactSubType() {
- $this->callAPISuccess('ContactType', 'create', array('name' => 'Big Bank', 'parent_id' => 'Organization'));
- $customGroup = $this->CustomGroupCreate(array('extends' => 'Organization', 'extends_entity_column_value' => array('Big Bank')));
+ $this->callAPISuccess('ContactType', 'create', array('name' => 'Big Bank', 'label' => 'biggee', 'parent_id' => 'Organization'));
+ $customGroup = $this->CustomGroupCreate(array('extends' => 'Organization', 'extends_entity_column_value' => array('Big_Bank')));
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
- $result1 = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, array('Big Bank'));
+ $result1 = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, array('Big_Bank'));
$this->assertEquals('Custom Field', $result1[$customGroup['id']]['fields'][$customField['id']]['label']);
- $result = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, CRM_Core_DAO::VALUE_SEPARATOR . 'Big Bank' . CRM_Core_DAO::VALUE_SEPARATOR);
+ $result = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, CRM_Core_DAO::VALUE_SEPARATOR . 'Big_Bank' . CRM_Core_DAO::VALUE_SEPARATOR);
$this->assertEquals($result1, $result);
- $result = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, 'Big Bank');
+ $result = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, 'Big_Bank');
$this->assertEquals($result1, $result);
try {
CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, array('Small Kind Bank'));