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); } }