X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FDeprecatedUtils.php;h=af1b411902e2c1f0e83443d4f822e543c4ef84d5;hb=14033e02815cd04e846e29fa0227acea6e976635;hp=b6da19bb686fe5e803fb2b778df9f49228533471;hpb=7a07be0ded879e23af48b652d890b5dd88a8b421;p=civicrm-core.git diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index b6da19bb68..af1b411902 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -134,25 +134,8 @@ function _civicrm_api3_deprecated_activity_formatted_param(&$params, &$values, $ if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { $values[$key] = $value; $type = $customFields[$customFieldID]['html_type']; - if ($type == 'CheckBox' || $type == 'Multi-Select') { - $mulValues = explode(',', $value); - $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); - $values[$key] = []; - foreach ($mulValues as $v1) { - foreach ($customOption as $customValueID => $customLabel) { - $customValue = $customLabel['value']; - if ((strtolower(trim($customLabel['label'])) == strtolower(trim($v1))) || - (strtolower(trim($customValue)) == strtolower(trim($v1))) - ) { - if ($type == 'CheckBox') { - $values[$key][$customValue] = 1; - } - else { - $values[$key][] = $customValue; - } - } - } - } + if (CRM_Core_BAO_CustomField::isSerialized($customFields[$customFieldID])) { + $values[$key] = CRM_Import_Parser::unserializeCustomValue($customFieldID, $value, $type); } elseif ($type == 'Select' || $type == 'Radio') { $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); @@ -435,29 +418,24 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { $fields['Address'][$key] = NULL; $htmlType = $customFields[$customFieldID]['html_type'] ?? NULL; - switch ($htmlType) { - case 'CheckBox': - case 'Multi-Select': - if ($val) { - $mulValues = explode(',', $val); - $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); - $newValues[$key] = []; - foreach ($mulValues as $v1) { - foreach ($customOption as $v2) { - if ((strtolower($v2['label']) == strtolower(trim($v1))) || - (strtolower($v2['value']) == strtolower(trim($v1))) - ) { - if ($htmlType == 'CheckBox') { - $newValues[$key][$v2['value']] = 1; - } - else { - $newValues[$key][] = $v2['value']; - } - } + if (CRM_Core_BAO_CustomField::isSerialized($customFields[$customFieldID]) && $val) { + $mulValues = explode(',', $val); + $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); + $newValues[$key] = []; + foreach ($mulValues as $v1) { + foreach ($customOption as $v2) { + if ((strtolower($v2['label']) == strtolower(trim($v1))) || + (strtolower($v2['value']) == strtolower(trim($v1))) + ) { + if ($htmlType == 'CheckBox') { + $newValues[$key][$v2['value']] = 1; + } + else { + $newValues[$key][] = $v2['value']; } } } - break; + } } } }