Skip to content
Snippets Groups Projects
Commit d4d07f8f authored by eileen's avatar eileen
Browse files

Remove BAO_CustomGroup::postProcess deprecated in 5.71

parent 9e1f0054
Branches
Tags
No related merge requests found
......@@ -1275,105 +1275,6 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup implements \Civi
}
}
/**
* @deprecated since 5.71 will be remvoed around 5.77
* @see CRM_Dedupe_Finder::formatParams
*
* @param array $groupTree
* @param array $params
* @param bool $skipFile
*/
public static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
CRM_Core_Error::deprecatedFunctionWarning('no alternative');
// Get the Custom form values and groupTree
foreach ($groupTree as $groupID => $group) {
if ($groupID === 'info') {
continue;
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$serialize = CRM_Core_BAO_CustomField::isSerialized($field);
// Reset all checkbox, radio and multiselect data
if ($field['html_type'] == 'Radio' || $serialize) {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = 'NULL';
}
$v = NULL;
foreach ($params as $key => $val) {
if (preg_match('/^custom_(\d+)_?(-?\d+)?$/', $key, $match) &&
$match[1] == $field['id']
) {
$v = $val;
}
}
if (!isset($groupTree[$groupID]['fields'][$fieldId]['customValue'])) {
// field exists in db so populate value from "form".
$groupTree[$groupID]['fields'][$fieldId]['customValue'] = [];
}
// Serialize checkbox and multi-select data (using array keys for checkbox)
if ($serialize) {
$v = ($v && $field['html_type'] === 'Checkbox') ? array_keys($v) : $v;
$v = $v ? CRM_Utils_Array::implodePadded($v) : NULL;
}
switch ($field['html_type']) {
case 'Select Date':
$date = CRM_Utils_Date::processDate($v);
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = $date;
break;
case 'File':
if ($skipFile) {
break;
}
// store the file in d/b
$entityId = explode('=', $groupTree['info']['where'][0]);
$fileParams = ['upload_date' => date('YmdHis')];
if ($groupTree[$groupID]['fields'][$fieldId]['customValue']['fid']) {
$fileParams['id'] = $groupTree[$groupID]['fields'][$fieldId]['customValue']['fid'];
}
if (!empty($v)) {
$fileParams['uri'] = $v['name'];
$fileParams['mime_type'] = $v['type'];
CRM_Core_BAO_File::filePostProcess($v['name'],
$groupTree[$groupID]['fields'][$fieldId]['customValue']['fid'],
$groupTree[$groupID]['table_name'],
trim($entityId[1]),
FALSE,
TRUE,
$fileParams,
'custom_' . $fieldId,
$v['type']
);
}
$defaults = [];
$paramsFile = [
'entity_table' => $groupTree[$groupID]['table_name'],
'entity_id' => $entityId[1],
];
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_EntityFile',
$paramsFile,
$defaults
);
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = $defaults['file_id'];
break;
default:
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = $v;
break;
}
}
}
}
/**
* Generic function to build all the form elements for a specific group tree.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment