From 7dd0fe07ac474ff0901fbd98180cf53ae7d7830d Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 18 Jun 2018 15:23:04 +0300 Subject: [PATCH] fixes --- application/Espo/Services/ActionHistoryRecord.php | 2 ++ application/Espo/Services/AuthLogRecord.php | 2 ++ application/Espo/Services/PortalRole.php | 2 ++ application/Espo/Services/Role.php | 2 ++ application/Espo/Services/User.php | 7 +++++++ client/res/templates/fields/json-object/detail.tpl | 4 +++- client/src/views/fields/json-object.js | 8 ++++++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/application/Espo/Services/ActionHistoryRecord.php b/application/Espo/Services/ActionHistoryRecord.php index 03148f53fc..265c3de866 100644 --- a/application/Espo/Services/ActionHistoryRecord.php +++ b/application/Espo/Services/ActionHistoryRecord.php @@ -39,6 +39,8 @@ class ActionHistoryRecord extends Record protected $listCountQueryDisabled = true; + protected $forceSelectAllAttributes = true; + public function loadParentNameFields(\Espo\ORM\Entity $entity) { if ($entity->get('targetId') && $entity->get('targetType')) { diff --git a/application/Espo/Services/AuthLogRecord.php b/application/Espo/Services/AuthLogRecord.php index 53f971c3bd..9db06983bf 100644 --- a/application/Espo/Services/AuthLogRecord.php +++ b/application/Espo/Services/AuthLogRecord.php @@ -39,6 +39,8 @@ class AuthLogRecord extends Record protected $actionHistoryDisabled = true; + protected $forceSelectAllAttributes = true; + protected $readOnlyAttributeList = [ "username", "portalId", diff --git a/application/Espo/Services/PortalRole.php b/application/Espo/Services/PortalRole.php index c5ea2d0d8e..49178a4f9c 100644 --- a/application/Espo/Services/PortalRole.php +++ b/application/Espo/Services/PortalRole.php @@ -39,6 +39,8 @@ class PortalRole extends Record $this->addDependency('fileManager'); } + protected $forceSelectAllAttributes = true; + public function afterCreate(Entity $entity, array $data = array()) { parent::afterCreate($entity, $data); diff --git a/application/Espo/Services/Role.php b/application/Espo/Services/Role.php index d18b0e6e40..04617eaa4c 100644 --- a/application/Espo/Services/Role.php +++ b/application/Espo/Services/Role.php @@ -39,6 +39,8 @@ class Role extends Record $this->addDependency('fileManager'); } + protected $forceSelectAllAttributes = true; + public function afterCreate(Entity $entity, array $data = array()) { parent::afterCreate($entity, $data); diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php index 2fc471231b..a98d7db3c8 100644 --- a/application/Espo/Services/User.php +++ b/application/Espo/Services/User.php @@ -63,6 +63,13 @@ class User extends Record 'accountsIds' ]; + protected $mandatorySelectAttributeList = [ + 'isPortalUser', + 'isActive', + 'userName', + 'isAdmin' + ]; + protected $linkSelectParams = array( 'targetLists' => array( 'additionalColumns' => array( diff --git a/client/res/templates/fields/json-object/detail.tpl b/client/res/templates/fields/json-object/detail.tpl index c1c9fdf661..f3babb16b9 100644 --- a/client/res/templates/fields/json-object/detail.tpl +++ b/client/res/templates/fields/json-object/detail.tpl @@ -1,2 +1,4 @@ - +{{#if isNotEmpty}} {{{value}}} +{{else}} +{{#if valueIsSet}}{{translate 'None'}}{{else}}...{{/if}}{{/if}} diff --git a/client/src/views/fields/json-object.js b/client/src/views/fields/json-object.js index 54d7ac17eb..cefa5cccca 100644 --- a/client/src/views/fields/json-object.js +++ b/client/src/views/fields/json-object.js @@ -36,7 +36,15 @@ Espo.define('views/fields/json-object', 'views/fields/base', function (Dep) { detailTemplate: 'fields/json-object/detail', + data: function () { + var data = Dep.prototype.data.call(this); + data.valueIsSet = this.model.has(this.name); + data.isNotEmpty = !!this.model.get(this.name); + return data; + }, + getValueForDisplay: function () { + if (!this.model.get(this.name)) return null; var text = JSON.stringify(this.model.get(this.name), false, 2).replace(/(\r\n|\n|\r)/gm, '
').replace(/\s/g, ' '); return text;