refactoring
This commit is contained in:
@@ -32,8 +32,13 @@ namespace Espo\Modules\Crm\Repositories;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
class Meeting extends \Espo\Core\Repositories\Event
|
||||
use Espo\Core\Di;
|
||||
|
||||
class Meeting extends \Espo\Core\Repositories\Event implements Di\ConfigAware, Di\UserAware
|
||||
{
|
||||
use Di\ConfigSetter;
|
||||
use Di\UserSetter;
|
||||
|
||||
protected function beforeSave(Entity $entity, array $options = [])
|
||||
{
|
||||
if (!$entity->isNew() && $entity->isAttributeChanged('parentId')) {
|
||||
@@ -97,7 +102,7 @@ class Meeting extends \Espo\Core\Repositories\Event
|
||||
|
||||
parent::beforeSave($entity, $options);
|
||||
|
||||
if (!$this->getConfig()->get('eventAssignedUserIsAttendeeDisabled')) {
|
||||
if (!$this->config->get('eventAssignedUserIsAttendeeDisabled')) {
|
||||
if ($entity->hasLinkMultipleField('assignedUsers')) {
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList('assignedUsers');
|
||||
foreach ($assignedUserIdList as $assignedUserId) {
|
||||
@@ -116,7 +121,7 @@ class Meeting extends \Espo\Core\Repositories\Event
|
||||
}
|
||||
|
||||
if ($entity->isNew()) {
|
||||
$currentUserId = $this->getEntityManager()->getUser()->id;
|
||||
$currentUserId = $this->user->id;
|
||||
if (
|
||||
$entity->hasLinkMultipleId('users', $currentUserId)
|
||||
&&
|
||||
|
||||
@@ -36,7 +36,12 @@ use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Meeting extends \Espo\Services\Record {
|
||||
use Espo\Core\Di;
|
||||
|
||||
class Meeting extends \Espo\Services\Record implements
|
||||
Di\HookManagerAware
|
||||
{
|
||||
use Di\HookManagerSetter;
|
||||
|
||||
protected $validateRequiredSkipFieldList = [
|
||||
'dateEnd'
|
||||
@@ -219,7 +224,7 @@ class Meeting extends \Espo\Services\Record {
|
||||
'inviteeId' => $userId,
|
||||
];
|
||||
|
||||
$this->getEntityManager()->getHookManager()->process($this->entityType, 'afterConfirmation', $entity, [], $actionData);
|
||||
$this->hookManager->process($this->entityType, 'afterConfirmation', $entity, [], $actionData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user