Skip to content

EspoCRM – Open Source CRM Application

target list categories

Yuri Kuznetsovc313e72f7598
diff --git a/application/Espo/Modules/Crm/Controllers/TargetListCategory.php b/application/Espo/Modules/Crm/Controllers/TargetListCategory.php
new file mode 100644
index 0000000000..3416d445a8
--- /dev/null
+++ b/application/Espo/Modules/Crm/Controllers/TargetListCategory.php
@@ -0,0 +1,36 @@
+<?php
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM – Open Source CRM application.
+ * Copyright (C) 2014-2025 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
+ * Website: https://www.espocrm.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU Affero General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+namespace Espo\Modules\Crm\Controllers;
+
+use Espo\Core\Templates\Controllers\CategoryTree;
+
+class TargetListCategory extends CategoryTree
+{
+}
diff --git a/application/Espo/Modules/Crm/Entities/TargetListCategory.php b/application/Espo/Modules/Crm/Entities/TargetListCategory.php
new file mode 100644
index 0000000000..7c22660205
--- /dev/null
+++ b/application/Espo/Modules/Crm/Entities/TargetListCategory.php
@@ -0,0 +1,37 @@
+<?php
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM – Open Source CRM application.
+ * Copyright (C) 2014-2025 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
+ * Website: https://www.espocrm.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU Affero General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+namespace Espo\Modules\Crm\Entities;
+
+use Espo\Core\Templates\Entities\CategoryTree;
+
+class TargetListCategory extends CategoryTree
+{
+ public const ENTITY_TYPE = 'TargetListCategory';
+}
diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Global.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Global.json
index 2b2a0cd9e9..5522f79f6c 100644
--- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Global.json
+++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Global.json
@@ -20,7 +20,8 @@
"Activities": "Activities",
"KnowledgeBaseArticle": "Knowledge Base Article",
"KnowledgeBaseCategory": "Knowledge Base Category",
- "CampaignLogRecord": "Campaign Log Record"
+ "CampaignLogRecord": "Campaign Log Record",
+ "TargetListCategory": "Target List Category"
},
"scopeNamesPlural": {
"Account": "Accounts",
@@ -43,7 +44,8 @@
"Activities": "Activities",
"KnowledgeBaseArticle": "Knowledge Base",
"KnowledgeBaseCategory": "Knowledge Base Categories",
- "CampaignLogRecord": "Campaign Log Records"
+ "CampaignLogRecord": "Campaign Log Records",
+ "TargetListCategory": "Target List Categories"
},
"dashlets": {
"Leads": "My Leads",
diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetList.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetList.json
index 4606e180c1..c14e7c7d4f 100644
--- a/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetList.json
+++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetList.json
@@ -11,14 +11,16 @@
"excludingActionList": "Excluding",
"targetStatus": "Target Status",
"isOptedOut": "Is Opted Out",
- "sourceCampaign": "Source Campaign"
+ "sourceCampaign": "Source Campaign",
+ "category": "Category"
},
"links": {
"accounts": "Accounts",
"contacts": "Contacts",
"leads": "Leads",
"campaigns": "Campaigns",
- "massEmails": "Mass Emails"
+ "massEmails": "Mass Emails",
+ "category": "Category"
},
"options": {
"type": {
diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetListCategory.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetListCategory.json
new file mode 100644
index 0000000000..76536a122f
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/TargetListCategory.json
@@ -0,0 +1,8 @@
+{
+ "labels": {
+ "Create TargetListCategory": "Create Category"
+ },
+ "links": {
+ "targetLists": "Target Lists"
+ }
+}
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetList/detail.json b/application/Espo/Modules/Crm/Resources/layouts/TargetList/detail.json
index f899e7bde9..5b5dd9704e 100644
--- a/application/Espo/Modules/Crm/Resources/layouts/TargetList/detail.json
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetList/detail.json
@@ -1,10 +1,9 @@
[
{
- "label": "",
- "rows":[
- [{"name":"name"}, {"name":"entryCount"}],
- [false, {"name":"optedOutCount"}],
- [{"name":"description", "fullWidth": true}]
+ "rows": [
+ [{"name": "name"}, {"name": "entryCount"}],
+ [{"name": "category"}, {"name": "optedOutCount"}],
+ [{"name": "description", "fullWidth": true}]
]
}
]
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetList/detailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/TargetList/detailSmall.json
index d3153943b8..27ab42a94b 100644
--- a/application/Espo/Modules/Crm/Resources/layouts/TargetList/detailSmall.json
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetList/detailSmall.json
@@ -1,11 +1,10 @@
[
{
- "label": "",
"rows": [
- [{"name":"name", "fullWidth": true}],
- [{"name":"entryCount", "fullWidth": true}],
- [{"name":"optedOutCount", "fullWidth": true}],
- [{"name":"description", "fullWidth": true}]
+ [{"name": "name"}],
+ [{"name": "category"}],
+ [{"name": "entryCount"}, {"name": "optedOutCount"}],
+ [{"name": "description"}]
]
}
]
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetList/massUpdate.json b/application/Espo/Modules/Crm/Resources/layouts/TargetList/massUpdate.json
new file mode 100644
index 0000000000..ec76fb7c48
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetList/massUpdate.json
@@ -0,0 +1,5 @@
+[
+ "teams",
+ "assignedUser",
+ "category"
+]
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detail.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detail.json
new file mode 100644
index 0000000000..c0caea021e
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detail.json
@@ -0,0 +1,27 @@
+[
+ {
+ "label": "",
+ "rows": [
+ [
+ {
+ "name": "name"
+ },
+ {
+ "name": "parent"
+ }
+ ],
+ [
+ {
+ "name": "order"
+ },
+ false
+ ],
+ [
+ {
+ "name": "description",
+ "fullWidth": true
+ }
+ ]
+ ]
+ }
+]
\ No newline at end of file
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detailSmall.json
new file mode 100644
index 0000000000..ec324670d4
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/detailSmall.json
@@ -0,0 +1,22 @@
+[
+ {
+ "label": "",
+ "rows": [
+ [
+ {
+ "name": "name"
+ }
+ ],
+ [
+ {
+ "name": "order"
+ }
+ ],
+ [
+ {
+ "name": "parent"
+ }
+ ]
+ ]
+ }
+]
\ No newline at end of file
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/filters.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/filters.json
new file mode 100644
index 0000000000..01ce97db13
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/filters.json
@@ -0,0 +1,4 @@
+[
+ "parent",
+ "teams"
+]
\ No newline at end of file
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/list.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/list.json
new file mode 100644
index 0000000000..ed87a7df77
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/list.json
@@ -0,0 +1,10 @@
+[
+ {
+ "name": "name",
+ "link": true
+ },
+ {
+ "name": "parent",
+ "width": 50
+ }
+]
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/listSmall.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/listSmall.json
new file mode 100644
index 0000000000..ed87a7df77
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/listSmall.json
@@ -0,0 +1,10 @@
+[
+ {
+ "name": "name",
+ "link": true
+ },
+ {
+ "name": "parent",
+ "width": 50
+ }
+]
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/massUpdate.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/massUpdate.json
new file mode 100644
index 0000000000..314dfb993d
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/massUpdate.json
@@ -0,0 +1,3 @@
+[
+ "teams"
+]
\ No newline at end of file
diff --git a/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/relationships.json b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/relationships.json
new file mode 100644
index 0000000000..95e6eb2e15
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/layouts/TargetListCategory/relationships.json
@@ -0,0 +1,4 @@
+[
+ "children",
+ "targetLists"
+]
diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetList.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetList.json
index 2209013ae9..201da6d7ed 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetList.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetList.json
@@ -12,8 +12,14 @@
}
]
},
+ "views": {
+ "list": "views/list-with-categories"
+ },
"recordViews":{
- "detail":"crm:views/target-list/record/detail"
+ "detail": "crm:views/target-list/record/detail"
+ },
+ "modalViews": {
+ "select": "views/modals/select-records-with-categories"
},
"relationshipPanels":{
"contacts":{
diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetListCategory.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetListCategory.json
new file mode 100644
index 0000000000..76704692a4
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/TargetListCategory.json
@@ -0,0 +1,42 @@
+{
+ "controller": "controllers/record-tree",
+ "collection": "collections/tree",
+ "menu": {
+ "listTree": {
+ "buttons": [
+ {
+ "label": "List View",
+ "link": "#TargetListCategory\/list",
+ "acl": "read"
+ },
+ {
+ "labelTranslation": "Global.scopeNamesPlural.TargetList",
+ "link": "#TargetList",
+ "acl": "read",
+ "aclScope": "TargetList"
+ }
+ ]
+ },
+ "list": {
+ "buttons": [
+ {
+ "label": "Tree View",
+ "link": "#TargetListCategory",
+ "acl": "read"
+ },
+ {
+ "labelTranslation": "Global.scopeNamesPlural.TargetList",
+ "link": "#TargetList",
+ "acl": "read",
+ "aclScope": "TargetList"
+ }
+ ]
+ }
+ },
+ "relationshipPanels": {
+ "children": {
+ "selectDisabled": true,
+ "unlinkDisabled": true
+ }
+ }
+}
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json
index 68e965502b..793c48210f 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json
@@ -5,6 +5,10 @@
"required": true,
"pattern": "$noBadCharacters"
},
+ "category": {
+ "type": "link",
+ "view": "views/fields/link-category-tree"
+ },
"entryCount": {
"type": "int",
"readOnly": true,
@@ -133,6 +137,11 @@
"relationName": "entityTeam",
"layoutRelationshipsDisabled": true
},
+ "category": {
+ "type": "belongsTo",
+ "foreign": "category",
+ "entity": "TargetListCategory"
+ },
"campaigns": {
"type": "hasMany",
"entity": "Campaign",
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetListCategory.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetListCategory.json
new file mode 100644
index 0000000000..4799100599
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetListCategory.json
@@ -0,0 +1,100 @@
+{
+ "fields": {
+ "name": {
+ "type": "varchar",
+ "required": true
+ },
+ "order": {
+ "type": "int",
+ "minValue": 1,
+ "required": true,
+ "textFilterDisabled": true
+ },
+ "description": {
+ "type": "text"
+ },
+ "createdAt": {
+ "type": "datetime",
+ "readOnly": true
+ },
+ "modifiedAt": {
+ "type": "datetime",
+ "readOnly": true
+ },
+ "createdBy": {
+ "type": "link",
+ "readOnly": true
+ },
+ "modifiedBy": {
+ "type": "link",
+ "readOnly": true
+ },
+ "teams": {
+ "type": "linkMultiple"
+ },
+ "parent": {
+ "type": "link"
+ },
+ "childList": {
+ "type": "jsonArray",
+ "notStorable": true
+ }
+ },
+ "links": {
+ "createdBy": {
+ "type": "belongsTo",
+ "entity": "User"
+ },
+ "modifiedBy": {
+ "type": "belongsTo",
+ "entity": "User"
+ },
+ "teams": {
+ "type": "hasMany",
+ "entity": "Team",
+ "relationName": "entityTeam",
+ "layoutRelationshipsDisabled": true
+ },
+ "parent": {
+ "type": "belongsTo",
+ "foreign": "children",
+ "entity": "TargetListCategory"
+ },
+ "children": {
+ "type": "hasMany",
+ "foreign": "parent",
+ "entity": "TargetListCategory",
+ "readOnly": true
+ },
+ "targetLists": {
+ "type": "hasMany",
+ "foreign": "category",
+ "entity": "TargetList"
+ }
+ },
+ "collection": {
+ "orderBy": "parent",
+ "order": "asc"
+ },
+ "additionalTables": {
+ "TargetListCategoryPath": {
+ "attributes": {
+ "id": {
+ "type": "id",
+ "dbType": "integer",
+ "len": 11,
+ "autoincrement": true
+ },
+ "ascendorId": {
+ "type": "foreignId",
+ "index": true
+ },
+ "descendorId" : {
+ "type": "foreignId",
+ "index": true
+ }
+ }
+ }
+ },
+ "repositoryClassName": "Espo\\Core\\Repositories\\CategoryTree"
+}
diff --git a/application/Espo/Modules/Crm/Resources/metadata/recordDefs/TargetListCategory.json b/application/Espo/Modules/Crm/Resources/metadata/recordDefs/TargetListCategory.json
new file mode 100644
index 0000000000..9e77ee7f65
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/metadata/recordDefs/TargetListCategory.json
@@ -0,0 +1,10 @@
+{
+ "massActions": {
+ "update": {
+ "allowed": true
+ },
+ "delete": {
+ "allowed": true
+ }
+ }
+}
diff --git a/application/Espo/Modules/Crm/Resources/metadata/scopes/TargetListCategory.json b/application/Espo/Modules/Crm/Resources/metadata/scopes/TargetListCategory.json
new file mode 100644
index 0000000000..392c446044
--- /dev/null
+++ b/application/Espo/Modules/Crm/Resources/metadata/scopes/TargetListCategory.json
@@ -0,0 +1,22 @@
+{
+ "entity": true,
+ "acl": true,
+ "aclLevelList": [
+ "all",
+ "team",
+ "no"
+ ],
+ "module": "Crm",
+ "customizable": false,
+ "entityManager": {
+ "fields": false,
+ "formula": false,
+ "relationships": false,
+ "addField": false,
+ "edit": false,
+ "layouts": false
+ },
+ "type": "CategoryTree",
+ "categoryParentEntityType": "TargetList",
+ "categoryField": "category"
+}