switch ($html_type) {
case 'Radio':
if ($data_type == 'Boolean') {
- $option = array('No', 'Yes');
+ $options = array('No', 'Yes');
+ }
+ else {
+ $options = $option;
}
if (is_array($value)) {
$display = NULL;
foreach ($value as $data) {
- $display .= $display ? ', ' . $option[$data] : $option[$data];
+ $display .= $display ? ', ' . $options[$data] : $options[$data];
}
}
else {
- $display = CRM_Utils_Array::value($value, $option);
+ $display = CRM_Utils_Array::value($value, $options);
}
break;
case 'AdvMulti-Select':
case 'Multi-Select':
if (is_array($value)) {
+ if ($html_type == 'CheckBox') {
+ // CRM-12989 fix
+ CRM_Utils_Array::formatArrayKeys($value);
+ }
+
$checkedData = $value;
}
else {
case 'Select State/Province':
case 'Multi-Select State/Province':
- $display = NULL;
- $option = CRM_Core_PseudoConstant::stateProvince(FALSE, FALSE);
- foreach ((array) $value as $data) {
- $display .= $display ? ', ' . $option[$data] : $option[$data];
- }
- break;
-
case 'Select Country':
case 'Multi-Select Country':
- $countries = CRM_Core_PseudoConstant::country(FALSE, FALSE);
+ if (strstr($html_type, 'State/Province')) {
+ $option = CRM_Core_PseudoConstant::stateProvince(FALSE, FALSE);
+ }
+ else {
+ $option = CRM_Core_PseudoConstant::country(FALSE, FALSE);
+ }
+ // process multi-select state/country field values
+ if (!is_array($value)) {
+ $value = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+ }
+
$display = NULL;
- foreach ((array) $value as $countryID) {
- $display .= $display ? ', ' . $countries[$countryID] : $countries[$countryID];
+ foreach ($value as $data) {
+ $display .= ($display && !empty($option[$data])) ? ', ' . $option[$data] : $option[$data];
}
break;
* @param int $fileID
* @param bool $absolute
*
+ * @param string $multiRecordWhereClause
+ *
* @return array
*/
public static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE, $multiRecordWhereClause = NULL) {
$customFields[$customFieldId]['html_type'] == 'AdvMulti-Select'
) {
if ($value) {
- // Note that only during merge this is not an array,
- // and you can directly use value, CRM-4385
- if (is_array($value)) {
- $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_values($value)
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
- }
+ $value = CRM_Utils_Array::implodePadded($value);
}
else {
$value = '';