From: Eileen McNaughton Date: Wed, 6 Dec 2023 23:18:19 +0000 (+1300) Subject: Fix UFGroup add to call writeRecord X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f5977b93b06d30fcc5ac25035ad3a9443575a1e8;p=civicrm-core.git Fix UFGroup add to call writeRecord --- 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); } /**