From 51d4b787fa963332df03862309ec0b25bca7a1f1 Mon Sep 17 00:00:00 2001 From: SinergiaCRM Date: Mon, 7 Oct 2024 16:18:33 +0000 Subject: [PATCH] Fix #10545 - Current user groups are used instead of "created by" groups when they differ --- modules/SecurityGroups/SecurityGroup.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/SecurityGroups/SecurityGroup.php b/modules/SecurityGroups/SecurityGroup.php index 37ce4452728..c9caf9d18a4 100755 --- a/modules/SecurityGroups/SecurityGroup.php +++ b/modules/SecurityGroups/SecurityGroup.php @@ -281,7 +281,11 @@ public static function inherit_creator($focus, $isUpdate) } elseif ($focus->db->dbType == 'mssql') { $query .= ' lower(newid()) '; } - $currentUserId = isset($current_user->id) ? $focus->db->quote($current_user->id) : null; + if (isset($focus->created_by) && $focus->created_by!= '') { + $currentUserId = $focus->db->quote($focus->created_by); + } else { + $currentUserId = isset($current_user->id) ? $focus->db->quote($current_user->id) : null; + } $recordId = $focus->db->quote($focus->id); $query .= ",u.securitygroup_id,'$recordId','$focus->module_dir'," . $focus->db->convert('', 'today') . ',0 '