Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove always true parameter & associated IF from previously shared function #29531

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 3 additions & 43 deletions CRM/Dedupe/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,9 @@ private static function appendCustomDataFields(array &$fields, array &$flat, str
// Only return custom for subType + unrestricted or return all custom
// fields.
$tree = self::getTree($ctype, $subTypes);
self::postProcess($tree, $fields, TRUE);
self::postProcess($tree, $fields);
unset($tree['info']);
foreach ($tree as $key => $cg) {
if (!is_int($key)) {
continue;
}
foreach ($cg['fields'] as $cf) {
$flat[$cf['column_name']] = $cf['customValue']['data'] ?? NULL;
}
Expand All @@ -190,9 +188,8 @@ private static function appendCustomDataFields(array &$fields, array &$flat, str
*
* @param array $groupTree
* @param array $params
* @param bool $skipFile
*/
private static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
private static function postProcess(&$groupTree, $params) {
// Get the Custom form values and groupTree
foreach ($groupTree as $groupID => $group) {
if ($groupID === 'info') {
Expand Down Expand Up @@ -235,43 +232,6 @@ private static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
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:
Expand Down