diff --git a/application/Espo/Modules/Crm/Services/Activities.php b/application/Espo/Modules/Crm/Services/Activities.php index 924fbd8a78..f51b35a702 100644 --- a/application/Espo/Modules/Crm/Services/Activities.php +++ b/application/Espo/Modules/Crm/Services/Activities.php @@ -1043,9 +1043,9 @@ class Activities extends \Espo\Core\Services\Base 'createdAt' ]; - $wherePart = array( + $wherePart = [ 'assignedUserId' => $userId, - ); + ]; if ($seed->hasRelation('users')) { $wherePart['usersMiddle.userId'] = $userId; @@ -1055,35 +1055,39 @@ class Activities extends \Espo\Core\Services\Base $wherePart['assignedUsersMiddle.userId'] = $userId; } - $selectParams = array( + $selectParams = [ 'select' => $select, 'leftJoins' => [], - 'whereClause' => array( + 'whereClause' => [ 'OR' => $wherePart, - array( - 'OR' => array( - array( + [ + 'OR' => [ + [ 'dateEnd' => null, 'dateStart>=' => $from, 'dateStart<' => $to - ), - array( + ], + [ + 'dateStart>=' => $from, + 'dateStart<' => $to + ], + [ 'dateEnd>=' => $from, 'dateEnd<' => $to - ), - array( + ], + [ 'dateStart<=' => $from, 'dateEnd>=' => $to - ), - array( + ], + [ 'dateEndDate!=' => null, 'dateEndDate>=' => $from, 'dateEndDate<' => $to - ) - ) - ) - ) - ); + ] + ] + ] + ] + ]; if ($seed->hasRelation('users')) { $selectParams['leftJoins'][] = 'users'; diff --git a/client/modules/crm/res/templates/calendar/timeline.tpl b/client/modules/crm/res/templates/calendar/timeline.tpl index 7383aa9927..2b796664e9 100644 --- a/client/modules/crm/res/templates/calendar/timeline.tpl +++ b/client/modules/crm/res/templates/calendar/timeline.tpl @@ -4,8 +4,8 @@