From b29cbec3a1645fd6dcc9cf5af9fcfc18fb2adb65 Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 12 Feb 2016 12:33:19 +0200 Subject: [PATCH] kb fix --- .../Resources/i18n/en_US/KnowledgeBaseArticle.json | 3 +++ .../metadata/entityDefs/KnowledgeBaseArticle.json | 3 ++- .../Crm/SelectManagers/KnowledgeBaseArticle.php | 11 ++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/KnowledgeBaseArticle.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/KnowledgeBaseArticle.json index cd74f90a3d..b7f2160837 100644 --- a/application/Espo/Modules/Crm/Resources/i18n/en_US/KnowledgeBaseArticle.json +++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/KnowledgeBaseArticle.json @@ -33,6 +33,9 @@ "Article": "Article" } }, + "tooltips": { + "portals": "If not empty then this article will be available only in specified portals. If empty then it will available in all portals." + }, "presetFilters": { "published": "Published" } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json index 9816b081ee..2566e2e86c 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json @@ -20,7 +20,8 @@ "options": ["Article"] }, "portals": { - "type": "linkMultiple" + "type": "linkMultiple", + "tooltip": true }, "publishDate": { "type": "date" diff --git a/application/Espo/Modules/Crm/SelectManagers/KnowledgeBaseArticle.php b/application/Espo/Modules/Crm/SelectManagers/KnowledgeBaseArticle.php index 2e6274f152..7fbdbf550e 100644 --- a/application/Espo/Modules/Crm/SelectManagers/KnowledgeBaseArticle.php +++ b/application/Espo/Modules/Crm/SelectManagers/KnowledgeBaseArticle.php @@ -46,9 +46,14 @@ class KnowledgeBaseArticle extends \Espo\Core\SelectManagers\Base $this->filterPublished($result); $this->setDistinct(true, $result); - $this->addJoin('portals', $result); - $this->addAndWhere(array( - 'portals.id' => $this->getUser()->get('portalId') + $this->addLeftJoin('portals', $result); + $this->addOrWhere(array( + array( + 'portals.id' => $this->getUser()->get('portalId') + ), + array( + 'portals.id' => null + ) ), $result); } }