This commit is contained in:
Yuri Kuznetsov
2024-04-25 14:42:22 +03:00
parent 689d59df2e
commit 4aa4b17c9f
3 changed files with 28 additions and 7 deletions
@@ -87,7 +87,7 @@ class BeforeCreate implements SaveHook
$entity->clear('usersIds');
$entity->clear('teamsIds');
$entity->clear('portalsIds');
$entity->set('usersIds', [$this->user->getId()]);
$entity->setUsersIds([$this->user->getId()]);
$entity->set('isForSelf', true);
break;
+21
View File
@@ -29,6 +29,7 @@
namespace Espo\Entities;
use Espo\Core\Field\LinkMultiple;
use Espo\Core\Field\LinkParent;
use Espo\Core\ORM\Entity;
@@ -306,4 +307,24 @@ class Note extends Entity
}
}
}
/**
* @param string[] $ids
*/
public function setTeamsIds(array $ids): self
{
$this->set('teamsIds', $ids);
return $this;
}
/**
* @param string[] $ids
*/
public function setUsersIds(array $ids): self
{
$this->set('usersIds', $ids);
return $this;
}
}
+6 -6
View File
@@ -397,13 +397,13 @@ class Service
$note->setAclIsProcessed();
$note->set('teamsIds', []);
$note->set('usersIds', []);
$note->setTeamsIds([]);
$note->setUsersIds([]);
if ($entity->hasLinkMultipleField('teams')) {
$teamIdList = $entity->getLinkMultipleIdList('teams');
$note->set('teamsIds', $teamIdList);
$note->setTeamsIds($teamIdList);
}
$ownerUserField = $this->aclManager->getReadOwnerUserField($entity->getEntityType());
@@ -447,7 +447,7 @@ class Service
$userIdList = [$userId];
}
$note->set('usersIds', $userIdList);
$note->setUsersIds($userIdList);
}
public function noteEmailReceived(Entity $entity, Email $email, bool $isInitial = false): void
@@ -1349,11 +1349,11 @@ class Service
}
if ($teamsAttributeIsChanged || $forceProcessNoteNotifications) {
$note->set('teamsIds', $teamIdList);
$note->setTeamsIds($teamIdList);
}
if ($usersAttributeIsChanged || $forceProcessNoteNotifications) {
$note->set('usersIds', $userIdList);
$note->setUsersIds($userIdList);
}
$this->entityManager->saveEntity($note, [