From c3485f1018c319cf63a512477e2b7f74191ff105 Mon Sep 17 00:00:00 2001 From: lucky091588 Date: Wed, 9 Dec 2020 11:33:09 +0800 Subject: [PATCH] Revert back --- CRM/Core/BAO/UFGroup.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 669767cb30a6..f1b49eceae21 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1466,13 +1466,15 @@ public static function add(&$params, $ids = []) { $ufGroup = new CRM_Core_DAO_UFGroup(); $ufGroup->copyValues($params); - if (empty($params['name'])) { + $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 (empty($params['name'])) { + if (!$ufGroupID && empty($params['name'])) { $ufGroup->name = $ufGroup->name . "_{$ufGroup->id}"; $ufGroup->save(); }