activities controller change

This commit is contained in:
yuri
2018-11-01 15:52:47 +02:00
parent 983dc7c376
commit 2e4cc5f0be
2 changed files with 21 additions and 14 deletions
@@ -74,20 +74,7 @@ class Activities extends \Espo\Core\Controllers\Base
if ($userIdList) {
$userIdList = explode(',', $userIdList);
$resultList = [];
foreach ($userIdList as $userId) {
try {
$userResultList = $service->getEvents($userId, $from, $to, $scopeList);
} catch (\Exception $e) {
continue;
}
foreach ($userResultList as $item) {
$item['userId'] = $userId;
$resultList[] = $item;
}
}
return $resultList;
return $service->getEventsForUsers($userIdList, $from, $to, $scopeList);
} else {
if (!$userId) {
$userId = $this->getUser()->id;
@@ -1178,6 +1178,26 @@ class Activities extends \Espo\Core\Services\Base
return $selectParams;
}
public function getEventsForUsers($userIdList, $from, $to, $scopeList = null)
{
$resultList = [];
foreach ($userIdList as $userId) {
try {
$userResultList = $this->getEvents($userId, $from, $to, $scopeList);
} catch (\Exception $e) {
if ($e instanceof Forbidden) {
continue;
}
throw new \Exception($e->getMessage(), $e->getCode(), $e);
}
foreach ($userResultList as $item) {
$item['userId'] = $userId;
$resultList[] = $item;
}
}
return $resultList;
}
public function getEventsForTeams($teamIdList, $from, $to, $scopeList = null)
{
if ($this->getAcl()->get('userPermission') === 'no') {