From f5977b93b06d30fcc5ac25035ad3a9443575a1e8 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 7 Dec 2023 12:18:19 +1300 Subject: [PATCH] Fix UFGroup add to call writeRecord --- CRM/Core/BAO/UFGroup.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index fae355c2e7..6451188dcc 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1458,28 +1458,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup implements \Civi\Core\Ho $params['group_type'] = implode(',', $params['group_type']); } - $hook = empty($params['id']) ? 'create' : 'edit'; - CRM_Utils_Hook::pre($hook, 'UFGroup', ($params['id'] ?? NULL), $params); - - $ufGroup = new CRM_Core_DAO_UFGroup(); - $ufGroup->copyValues($params); - - $ufGroupID = CRM_Utils_Array::value('ufgroup', $ids, CRM_Utils_Array::value('id', $params)); - if (!$ufGroupID && empty($params['name'])) { - $ufGroup->name = CRM_Utils_String::munge($ufGroup->title, '_', 56); - } - $ufGroup->id = $ufGroupID; - - $ufGroup->save(); - - if (!$ufGroupID && empty($params['name'])) { - $ufGroup->name = $ufGroup->name . "_{$ufGroup->id}"; - $ufGroup->save(); - } - - CRM_Utils_Hook::post($hook, 'UFGroup', $ufGroup->id, $ufGroup); - - return $ufGroup; + return self::writeRecord($params); } /** -- 2.25.1