Skip to content

EspoCRM – Open Source CRM Application

Ref

Yuriied2ce3b2b8e0
diff --git a/application/Espo/Modules/Crm/Tools/Meeting/Service.php b/application/Espo/Modules/Crm/Tools/Meeting/Service.php
index 755c29158d..284d815edf 100644
--- a/application/Espo/Modules/Crm/Tools/Meeting/Service.php
+++ b/application/Espo/Modules/Crm/Tools/Meeting/Service.php
@@ -50,7 +50,7 @@ use LogicException;
class Service
{
- private const NOTE_TYPE_EVENT_CONFIRMATION = 'EventConfirmation';
+ private const string NOTE_TYPE_EVENT_CONFIRMATION = 'EventConfirmation';
public function __construct(
private User $user,
@@ -90,13 +90,13 @@ class Service
throw new LogicException();
}
- if (!$entity->hasLinkMultipleId('users', $this->user->getId())) {
+ if (!$entity->hasLinkMultipleId(Meeting::LINK_USERS, $this->user->getId())) {
throw new Forbidden();
}
$currentStatus = $this->entityManager
->getRDBRepository($entityType)
- ->getRelation($entity, 'users')
+ ->getRelation($entity, Meeting::LINK_USERS)
->getColumn($this->user, 'status');
if ($currentStatus === $status) {
@@ -105,7 +105,7 @@ class Service
$this->entityManager
->getRDBRepository($entityType)
- ->getRelation($entity, 'users')
+ ->getRelation($entity, Meeting::LINK_USERS)
->updateColumnsById($this->user->getId(), ['status' => $status]);
if ($this->metadata->get(['scopes', $entityType, 'stream'])) {
@@ -116,7 +116,7 @@ class Service
'eventName' => $entity->get(Field::NAME),
'eventType' => $entity->getEntityType(),
'eventId' => $entity->getId(),
- 'dateStart' => $entity->get('dateStart'),
+ 'dateStart' => $entity->get(Meeting::FIELD_DATE_START),
'status' => $status,
'link' => 'users',
'inviteeType' => User::ENTITY_TYPE,
@@ -156,7 +156,7 @@ class Service
throw new Forbidden();
}
- if (!$this->acl->checkField($entityType, 'status', Acl\Table::ACTION_EDIT)) {
+ if (!$this->acl->checkField($entityType, Meeting::FIELD_STATUS, Acl\Table::ACTION_EDIT)) {
throw new Forbidden("No edit access to 'status' field.");
}
@@ -167,7 +167,7 @@ class Service
continue;
}
- $entity->set('status', Meeting::STATUS_HELD);
+ $entity->set(Meeting::FIELD_STATUS, Meeting::STATUS_HELD);
$this->entityManager->saveEntity($entity);
}
@@ -183,7 +183,7 @@ class Service
throw new Forbidden();
}
- if (!$this->acl->checkField($entityType, 'status', Acl\Table::ACTION_EDIT)) {
+ if (!$this->acl->checkField($entityType, Meeting::FIELD_STATUS, Acl\Table::ACTION_EDIT)) {
throw new Forbidden("No edit access to 'status' field.");
}
@@ -194,7 +194,7 @@ class Service
continue;
}
- $entity->set('status', Meeting::STATUS_NOT_HELD);
+ $entity->set(Meeting::FIELD_STATUS, Meeting::STATUS_NOT_HELD);
$this->entityManager->saveEntity($entity);
}
@@ -224,9 +224,9 @@ class Service
}
$linkList = [
- 'users',
- 'contacts',
- 'leads',
+ Meeting::LINK_USERS,
+ Meeting::LINK_CONTACTS,
+ Meeting::LINK_LEADS,
];
$linkList = array_filter($linkList, function ($item) use ($entityType) {
@@ -241,8 +241,13 @@ class Service
$itemCollection = $this->entityManager
->getRDBRepository($entityType)
->getRelation($entity, $link)
- ->select([Attribute::ID, Field::NAME, 'acceptanceStatus', 'emailAddress'])
- ->order('name')
+ ->select([
+ Attribute::ID,
+ Field::NAME,
+ 'acceptanceStatus',
+ Field::EMAIL_ADDRESS,
+ ])
+ ->order(Field::NAME)
->find();
$list = array_merge($list, [...$itemCollection]);
@@ -252,15 +257,18 @@ class Service
$collection = $this->entityManager->getCollectionFactory()->create(null, $list);
foreach ($collection as $e) {
- if ($this->acl->checkEntityRead($e) && $this->acl->checkField($entityType, 'emailAddress')) {
+ if (
+ $this->acl->checkEntityRead($e) &&
+ $this->acl->checkField($e->getEntityType(), Field::EMAIL_ADDRESS)
+ ) {
continue;
}
- if (!$e->get('emailAddress')) {
+ if (!$e->get(Field::EMAIL_ADDRESS)) {
continue;
}
- $e->set('emailAddress', '[email protected]');
+ $e->set(Field::EMAIL_ADDRESS, '[email protected]');
}
return RecordCollection::create($collection);