EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Fix: stream note for scheduled emails missing user attribution (#3621)
uszekkk9e3eb854916a
diff --git a/application/Espo/Tools/Stream/Service.php b/application/Espo/Tools/Stream/Service.phpindex a20f245f62..6eb5d8fc9f 100644--- a/application/Espo/Tools/Stream/Service.php+++ b/application/Espo/Tools/Stream/Service.php@@ -558,10 +558,18 @@ class Serviceif (!$user->isSystem()) {$person = $user;} else {- $from = $email->getFromAddress();+ $createdBy = $email->getCreatedBy();- if ($from) {- $person = $this->getEmailAddressRepository()->getEntityByAddress($from);+ if ($createdBy) {+ $person = $this->entityManager->getEntityById(User::ENTITY_TYPE, $createdBy->getId());+ }++ if (!$person) {+ $from = $email->getFromAddress();++ if ($from) {+ $person = $this->getEmailAddressRepository()->getEntityByAddress($from);+ }}}