From 13b328d6674ba58fe211eaf8501b186c3efd7f39 Mon Sep 17 00:00:00 2001 From: colemanw Date: Thu, 18 Jan 2024 17:37:26 -0500 Subject: [PATCH] dev/core#4905 - ImportParser - Use cached function to get custom groups --- CRM/Custom/Import/Parser/Api.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php index 8ccef384a3ed..4643d058dd4e 100644 --- a/CRM/Custom/Import/Parser/Api.php +++ b/CRM/Custom/Import/Parser/Api.php @@ -1,7 +1,5 @@ addSelect('*', 'custom_group_id.is_multiple', 'custom_group_id.name', 'custom_group_id.extends') - ->addWhere('custom_group_id', '=', $customGroupID)->execute(); + $customGroup = CRM_Core_BAO_CustomGroup::getGroup(['id' => $customGroupID]); - foreach ($fields as $values) { - $datatype = $values['data_type'] ?? NULL; - if ($datatype === 'File') { + foreach ($customGroup['fields'] as $values) { + if ($values['data_type'] === 'File') { continue; } /* generate the key for the fields array */ @@ -206,10 +201,10 @@ private function getGroupFieldsForImport(int $customGroupID): array { 'is_search_range' => $values['is_search_range'], 'date_format' => $values['date_format'], 'time_format' => $values['time_format'], - 'extends' => $values['custom_group_id.extends'], + 'extends' => $customGroup['extends'], 'custom_group_id' => $customGroupID, - 'custom_group_id.name' => $values['custom_group_id.name'], - 'is_multiple' => $values['custom_group_id.is_multiple'], + 'custom_group_id.name' => $customGroup['name'], + 'is_multiple' => $customGroup['is_multiple'], ]; } return $importableFields;