From a6f41113838fedf5143ffefb75ef3fdf30430459 Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 1 Sep 2015 12:58:37 +0300 Subject: [PATCH] automatically accept meeting/call for current user --- .../Espo/Modules/Crm/Repositories/Meeting.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/application/Espo/Modules/Crm/Repositories/Meeting.php b/application/Espo/Modules/Crm/Repositories/Meeting.php index f4dac125a6..93b0bb7984 100644 --- a/application/Espo/Modules/Crm/Repositories/Meeting.php +++ b/application/Espo/Modules/Crm/Repositories/Meeting.php @@ -56,11 +56,28 @@ class Meeting extends \Espo\Core\ORM\Repositories\RDB $usersIds[] = $assignedUserId; $entity->set('usersIds', $usersIds); $hash = $entity->get('usersNames'); - if ($hash instanceof \stdClass) { + if ($hash instanceof \StdClass) { $hash->$assignedUserId = $entity->get('assignedUserName'); $entity->set('usersNames', $hash); } } + if ($entity->isNew()) { + $currentUserId = $this->getEntityManager()->getUser()->id; + if (in_array($currentUserId, $usersIds)) { + $usersColumns = $entity->get('usersColumns'); + if (empty($usersColumns)) { + $usersColumns = new \StdClass(); + } + if ($usersColumns instanceof \StdClass) { + if (!($usersColumns->$currentUserId instanceof \StdClass)) { + $usersColumns->$currentUserId = new \StdClass(); + } + if (empty($usersColumns->$currentUserId->status)) { + $usersColumns->$currentUserId->status = 'Accepted'; + } + } + } + } } }