portal users activities

This commit is contained in:
yuri
2016-05-04 11:25:12 +03:00
parent f7a0a0daa0
commit b91d237f0b
2 changed files with 35 additions and 7 deletions
@@ -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(
-5
View File
@@ -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());