From bc910ddedd974f021e0558afd08391e14fc4eb28 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 20 Feb 2024 10:09:27 +1100 Subject: [PATCH] dev/core#5005 Fix validating to allow for saving with entity sub filters that are disabled --- CRM/Core/BAO/CustomGroup.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index e6941666d8..a4bf0c9095 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -56,7 +56,11 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup implements \Civi } if (!CRM_Utils_System::isNull($extendsChildType)) { $b = self::getMungedEntity($params['extends'], $params['extends_entity_column_id'] ?? NULL); - $registeredSubTypes = self::getSubTypes()[$b]; + $subTypes = self::getExtendsEntityColumnValueOptions('validate', ['values' => $params]); + $registeredSubTypes = []; + foreach ($subTypes as $subTypeDetail) { + $registeredSubTypes[$subTypeDetail['id']] = $subTypeDetail['label']; + } if (is_array($extendsChildType)) { foreach ($extendsChildType as $childType) { if (!array_key_exists($childType, $registeredSubTypes) && !in_array($childType, $registeredSubTypes, TRUE)) { @@ -2113,9 +2117,6 @@ SELECT civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT $fkNameField = isset($fkFields['name']) ? 'name' : 'id'; $select = [$fkIdField, $fkNameField, $fkLabelField]; $where = []; - if (isset($fkFields['is_active'])) { - $where[] = ['is_active', '=', TRUE]; - } $fkEntities = civicrm_api4($field['fk_entity'], 'get', [ 'checkPermissions' => !(isset($params['check_permissions']) && !$params['check_permissions']), 'select' => $select, -- 2.25.1