mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
fix email notifications
This commit is contained in:
@@ -99,6 +99,7 @@ class Importer
|
||||
$usersIds = $duplicate->get('usersIds');
|
||||
$usersIds[] = $userId;
|
||||
$duplicate->set('usersIds', $usersIds);
|
||||
|
||||
$this->getEntityManager()->saveEntity($duplicate);
|
||||
|
||||
if (!empty($teamsIds)) {
|
||||
|
||||
@@ -43,13 +43,17 @@ class Email extends \Espo\Core\Notificators\Base
|
||||
|
||||
public function process(Entity $entity)
|
||||
{
|
||||
if ($entity->get('status') != 'Archived' && $entity->get('status') != 'Sent') {
|
||||
if ($entity->get('status') !== 'Archived' && $entity->get('status') !== 'Sent') {
|
||||
return;
|
||||
}
|
||||
|
||||
$previousUserIdList = $entity->getFetched('usersIds');
|
||||
if (!is_array($previousUserIdList)) {
|
||||
if ($entity->get('status') === 'Sent') {
|
||||
$previousUserIdList = [];
|
||||
} else {
|
||||
$previousUserIdList = $entity->getFetched('usersIds');
|
||||
if (!is_array($previousUserIdList)) {
|
||||
$previousUserIdList = [];
|
||||
}
|
||||
}
|
||||
|
||||
$emailUserIdList = $entity->get('usersIds');
|
||||
@@ -70,6 +74,10 @@ class Email extends \Espo\Core\Notificators\Base
|
||||
'emailName' => $entity->get('name'),
|
||||
);
|
||||
|
||||
if (!$entity->has('from')) {
|
||||
$this->getEntityManager()->getRepository('Email')->loadFromField($entity);
|
||||
}
|
||||
|
||||
$from = $entity->get('from');
|
||||
if ($from) {
|
||||
$person = $this->getEntityManager()->getRepository('EmailAddress')->getEntityByAddress($from, null, ['User', 'Contact', 'Lead']);
|
||||
|
||||
Reference in New Issue
Block a user