portal users activities
This commit is contained in:
@@ -102,11 +102,24 @@ class Activities extends \Espo\Core\Services\Base
|
||||
],
|
||||
'leftJoins' => [['users', 'usersLeft']],
|
||||
'whereClause' => array(
|
||||
'usersLeftMiddle.userId' => $entity->id
|
||||
),
|
||||
'customJoin' => ''
|
||||
);
|
||||
|
||||
$where = array(
|
||||
'usersLeftMiddle.userId' => $entity->id
|
||||
);
|
||||
|
||||
if ($entity->get('isPortalUser') && $entity->get('contactId')) {
|
||||
$selectParams['leftJoins'][] = ['contacts', 'contactsLeft'];
|
||||
$where['contactsLeftMiddle.contactId'] = $entity->get('contactId');
|
||||
$selectParams['whereClause'][] = array(
|
||||
'OR' => $where
|
||||
);
|
||||
} else {
|
||||
$selectParams['whereClause'][] = $where;
|
||||
}
|
||||
|
||||
if (!empty($statusList)) {
|
||||
$statusOpKey = 'status';
|
||||
if ($op == 'NOT IN') {
|
||||
@@ -142,11 +155,24 @@ class Activities extends \Espo\Core\Services\Base
|
||||
],
|
||||
'leftJoins' => [['users', 'usersLeft']],
|
||||
'whereClause' => array(
|
||||
'usersLeftMiddle.userId' => $entity->id
|
||||
),
|
||||
'customJoin' => ''
|
||||
);
|
||||
|
||||
$where = array(
|
||||
'usersLeftMiddle.userId' => $entity->id
|
||||
);
|
||||
|
||||
if ($entity->get('isPortalUser') && $entity->get('contactId')) {
|
||||
$selectParams['leftJoins'][] = ['contacts', 'contactsLeft'];
|
||||
$where['contactsLeftMiddle.contactId'] = $entity->get('contactId');
|
||||
$selectParams['whereClause'][] = array(
|
||||
'OR' => $where
|
||||
);
|
||||
} else {
|
||||
$selectParams['whereClause'][] = $where;
|
||||
}
|
||||
|
||||
if (!empty($statusList)) {
|
||||
$statusOpKey = 'status';
|
||||
if ($op == 'NOT IN') {
|
||||
@@ -164,6 +190,13 @@ class Activities extends \Espo\Core\Services\Base
|
||||
|
||||
protected function getUserEmailQuery($entity, $op = 'IN', $statusList = null)
|
||||
{
|
||||
if ($entity->get('isPortalUser') && $entity->get('contactId')) {
|
||||
$contact = $this->getEntityManager()->getEntity('Contact', $entity->get('contactId'));
|
||||
if ($contact) {
|
||||
return $this->getEmailQuery($contact, $op, $statusList);
|
||||
}
|
||||
}
|
||||
|
||||
$selectManager = $this->getSelectManagerFactory()->create('Email');
|
||||
|
||||
$selectParams = array(
|
||||
|
||||
@@ -57,11 +57,6 @@ Espo.define('views/user/record/detail', 'views/record/detail', function (Dep) {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.model.get('isPortalUser')) {
|
||||
this.hidePanel('activities');
|
||||
this.hidePanel('history');
|
||||
}
|
||||
|
||||
if (this.model.id == this.getUser().id) {
|
||||
this.listenTo(this.model, 'after:save', function () {
|
||||
this.getUser().set(this.model.toJSON());
|
||||
|
||||
Reference in New Issue
Block a user