// FIXME: We should not be using labels as keys!
$daoField = CRM_Utils_String::munge($ltype) . '-' . $type[0];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
+ $daoField .= "-" . $type[1];
}
// CRM-3157: localise country, region (both have ‘country’ context) and state_province (‘province’ context)
* @static void
* @access public
*/
- function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "") {
+ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "", $autoFind = TRUE) {
$result = array();
- if(isset($params['options']) && CRM_Utils_Array::value('is_count', $params['options'])) {
+ if(isset($params['options']) && !empty($params['options']['is_count'])) {
return $dao->count();
}
- if (empty($dao) || !$dao->find()) {
+ if (empty($dao)) {
+ return array();
+ }
+ if ($autoFind && !$dao->find()) {
return array();
}