From 5e4e0366b1e2c27e1e2245e7624350e5f56ef34a Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Wed, 7 Jun 2023 15:18:04 -0400 Subject: [PATCH] don't allow moving fields into reserved groups --- CRM/Custom/Form/MoveField.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CRM/Custom/Form/MoveField.php b/CRM/Custom/Form/MoveField.php index 59d2af4eb9..1f9ffe36be 100644 --- a/CRM/Custom/Form/MoveField.php +++ b/CRM/Custom/Form/MoveField.php @@ -91,7 +91,15 @@ class CRM_Custom_Form_MoveField extends CRM_Core_Form { */ public function buildQuickForm() { - $customGroup = CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + $customGroup = []; + $groups = \Civi\Api4\CustomGroup::get() + ->addWhere('is_reserved', '=', FALSE) + ->addWhere('is_active', '=', TRUE) + ->addSelect('id', 'title') + ->execute(); + foreach ($groups as $group) { + $customGroup[$group['id']] = $group['title']; + } unset($customGroup[$this->_srcGID]); if (empty($customGroup)) { CRM_Core_Error::statusBounce(ts('You need more than one custom group to move fields')); -- 2.25.1