<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
CRM_Utils_Array::lookupValue($states, 'state_province',
CRM_Core_PseudoConstant::stateProvince(), TRUE
);
- if (!CRM_Utils_Array::value('state_province_id', $states)) {
+ if (empty($states['state_province_id'])) {
CRM_Utils_Array::lookupValue($states, 'state_province',
CRM_Core_PseudoConstant::stateProvinceAbbreviation(), TRUE
);
CRM_Utils_Array::lookupValue($countries, 'country',
CRM_Core_PseudoConstant::country(), TRUE
);
- if (!CRM_Utils_Array::value('country_id', $countries)) {
+ if (empty($countries['country_id'])) {
CRM_Utils_Array::lookupValue($countries, 'country',
CRM_Core_PseudoConstant::countryIsoCode(), TRUE
);
$cvParam['type'] = 'Timestamp';
}
- if (CRM_Utils_Array::value('id', $customValue)) {
+ if (!empty($customValue['id'])) {
$cvParam['id'] = $customValue['id'];
}
if (!array_key_exists($customValue['table_name'], $cvParams)) {
cg.id as groupID,
cg.is_multiple,
cf.column_name,
- cf.id as fieldID
+ cf.id as fieldID,
+ cf.data_type as fieldDataType
FROM civicrm_custom_group cg,
civicrm_custom_field cf
WHERE cf.custom_group_id = cg.id
$fields[$dao->table_name][] = $dao->fieldID;
$select[$dao->table_name][] = "{$dao->column_name} AS custom_{$dao->fieldID}";
$isMultiple[$dao->table_name] = $dao->is_multiple ? TRUE : FALSE;
+ $file[$dao->table_name][$dao->fieldID] = $dao->fieldDataType;
}
$result = array();
$fieldName = "custom_{$fieldID}";
if ($isMultiple[$tableName]) {
if ($formatMultiRecordField) {
- $result["{$dao->id}"]["{$fieldID}"] = $dao->$fieldName;
+ if($file[$tableName][$fieldID] == 'File') {
+ if($fileid = $dao->$fieldName) {
+ $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
+ $result["{$dao->id}"]["{$fieldID}"] = $fileurl[$dao->$fieldName];
+ }
+ }
+ else {
+ $result["{$dao->id}"]["{$fieldID}"] = $dao->$fieldName;
+ }
} else {
$result["{$fieldID}_{$dao->id}"] = $dao->$fieldName;
}
}
else {
- $result[$fieldID] = $dao->$fieldName;
+ if($file[$tableName][$fieldID] == 'File') {
+ if($fileid = $dao->$fieldName) {
+ $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
+ $result[$fieldID] = $fileurl[$dao->$fieldName];
+ }
+ }
+ else {
+ $result[$fieldID] = $dao->$fieldName;
+ }
}
}
}