mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
email do not set sent by if draft
This commit is contained in:
@@ -717,6 +717,11 @@ class Email extends Entity
|
||||
return $this->getValueObject('sentBy');
|
||||
}
|
||||
|
||||
public function setSentBy(Link|User|null $sentBy): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('sentBy', $sentBy);
|
||||
}
|
||||
|
||||
public function getGroupFolder(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
|
||||
@@ -333,6 +333,7 @@ class Email extends Database implements
|
||||
$this->addUserByEmailAddressId($entity, $ids[0], true);
|
||||
|
||||
if (!$entity->getSentBy()) {
|
||||
/** @var UserEntity $user */
|
||||
$user = $this->getEmailAddressRepository()
|
||||
->getEntityByAddressId(
|
||||
$entity->get('fromEmailAddressId'),
|
||||
@@ -340,7 +341,8 @@ class Email extends Database implements
|
||||
true
|
||||
);
|
||||
|
||||
if ($user) {
|
||||
if ($user && $entity->getStatus() !== EmailEntity::STATUS_DRAFT) {
|
||||
$entity->setSentBy($user);
|
||||
$entity->set('sentById', $user->getId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user