Skip to content
Snippets Groups Projects
Commit 2760844f authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #2321 from lcdservices/CRM-14062

CRM-14062 support passing name to group API
parents 69a7d71a e2b7c67d
No related branches found
No related tags found
No related merge requests found
......@@ -354,7 +354,8 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
}
// form the name only if missing: CRM-627
if (!CRM_Utils_Array::value('name', $params) &&
$nameParam = CRM_Utils_Array::value('name', $params, NULL);
if (!$nameParam &&
!CRM_Utils_Array::value('id', $params)
) {
$params['name'] = CRM_Utils_String::titleToVar($params['title']);
......@@ -389,7 +390,9 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
array_keys($group->parents)
) . CRM_Core_DAO::VALUE_SEPARATOR;
}
if (!CRM_Utils_Array::value('id', $params)) {
if (!CRM_Utils_Array::value('id', $params) &&
!$nameParam
) {
$group->name .= "_tmp";
}
$group->save();
......@@ -398,7 +401,9 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
return NULL;
}
if (!CRM_Utils_Array::value('id', $params)) {
if (!CRM_Utils_Array::value('id', $params) &&
!$nameParam
) {
$group->name = substr($group->name, 0, -4) . "_{$group->id}";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment