EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
note about assignment populate names
Yuriia43e14a33f26
diff --git a/application/Espo/Tools/Stream/Service.php b/application/Espo/Tools/Stream/Service.phpindex 58f96f1ae3..a20f245f62 100644--- a/application/Espo/Tools/Stream/Service.php+++ b/application/Espo/Tools/Stream/Service.php@@ -1176,6 +1176,8 @@ class Service/** @var array<string, ?string> $newNames */$newNames = get_object_vars($entity->get(self::FIELD_ASSIGNED_USERS . 'Names') ?? (object) []);+ $this->prepareUserNameMap($newIds, $newNames);+/** @var string[] $prevIds */$prevIds = $entity->getFetched(self::FIELD_ASSIGNED_USERS . 'Ids') ?? [];/** @var array<string, ?string> $prevNames */@@ -1338,4 +1340,21 @@ class Servicereturn $statusData;}++ /**+ * @param string[] $ids+ * @param array<string, ?string> $names+ */+ private function prepareUserNameMap(array $ids, array &$names): void+ {+ foreach ($ids as $id) {+ if (array_key_exists($id, $names) && $names[$id] !== null) {+ continue;+ }++ $user = $this->entityManager->getRDBRepositoryByClass(User::class)->getById($id);++ $names[$id] = $user?->getName() ?? null;+ }+ }}