Skip to content

EspoCRM – Open Source CRM Application

campaign ref

Yuri Kuznetsov5b1647a42f69
diff --git a/application/Espo/Modules/Crm/Classes/RecordHooks/MassEmail/BeforeCreate.php b/application/Espo/Modules/Crm/Classes/RecordHooks/MassEmail/BeforeCreate.php
index 08b57baf42..43ae863635 100644
--- a/application/Espo/Modules/Crm/Classes/RecordHooks/MassEmail/BeforeCreate.php
+++ b/application/Espo/Modules/Crm/Classes/RecordHooks/MassEmail/BeforeCreate.php
@@ -50,5 +50,7 @@ class BeforeCreate implements SaveHook
if (!$this->acl->check($entity, Table::ACTION_EDIT)) {
throw new Forbidden("No 'edit' access.");
}
+
+
}
}
diff --git a/application/Espo/Modules/Crm/Resources/layouts/Campaign/bottomPanelsDetail.json b/application/Espo/Modules/Crm/Resources/layouts/Campaign/bottomPanelsDetail.json
index e03f6975d8..8b5c710e8e 100644
--- a/application/Espo/Modules/Crm/Resources/layouts/Campaign/bottomPanelsDetail.json
+++ b/application/Espo/Modules/Crm/Resources/layouts/Campaign/bottomPanelsDetail.json
@@ -1,14 +1,20 @@
{
- "campaignLogRecords": {
+ "massEmails": {
"index": 0
},
- "_delimiter_": {
+ "trackingUrls": {
"index": 1
},
- "opportunities": {
+ "campaignLogRecords": {
"index": 2
},
- "leads": {
+ "_delimiter_": {
"index": 3
+ },
+ "opportunities": {
+ "index": 4
+ },
+ "leads": {
+ "index": 5
}
-}
\ No newline at end of file
+}
diff --git a/application/Espo/Modules/Crm/Resources/layouts/Campaign/relationships.json b/application/Espo/Modules/Crm/Resources/layouts/Campaign/relationships.json
deleted file mode 100644
index da08eeee57..0000000000
--- a/application/Espo/Modules/Crm/Resources/layouts/Campaign/relationships.json
+++ /dev/null
@@ -1,5 +0,0 @@
-[
- "campaignLogRecords",
- "opportunities",
- "leads"
-]
diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
index a8d0ccd803..50f2d7bace 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
@@ -56,8 +56,8 @@
"view": "crm:views/campaign/record/panels/campaign-log-records",
"layout": "listForCampaign",
"rowActionsView": "views/record/row-actions/remove-only",
- "select": false,
- "create": false
+ "selectDisabled": false,
+ "createDisabled": false
},
"massEmails": {
"createAttributeMap": {
@@ -66,7 +66,14 @@
"excludingTargetListsIds": "excludingTargetListsIds",
"excludingTargetListsNames": "excludingTargetListsNames"
},
- "createHandler": "crm:handlers/campaign/mass-emails-create"
+ "createHandler": "crm:handlers/campaign/mass-emails-create",
+ "selectDisabled": true,
+ "recordListView": "crm:views/mass-email/record/list-for-campaign",
+ "rowActionsView": "crm:views/mass-email/record/row-actions/for-campaign"
+ },
+ "trackingUrls": {
+ "selectDisabled": true,
+ "rowActionsView": "views/record/row-actions/relationship-no-unlink"
}
},
"filterList": [
@@ -183,13 +190,35 @@
}
},
"panels": {
+ "massEmails": {
+ "visible": {
+ "conditionGroup": [
+ {
+ "type": "in",
+ "attribute": "type",
+ "value": ["Email", "Newsletter"]
+ }
+ ]
+ }
+ },
+ "trackingUrls": {
+ "visible": {
+ "conditionGroup": [
+ {
+ "type": "in",
+ "attribute": "type",
+ "value": ["Email", "Newsletter"]
+ }
+ ]
+ }
+ },
"mailMerge": {
"visible": {
"conditionGroup": [
{
- "type": "equals",
+ "type": "in",
"attribute": "type",
- "value": "Mail"
+ "value": ["Mail"]
}
]
}
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json
index 015062177e..b59e7a2297 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json
@@ -26,8 +26,16 @@
},
"type": {
"type": "enum",
- "options": ["Email", "Newsletter", "Web", "Television", "Radio", "Mail"],
+ "options": [
+ "Email",
+ "Newsletter",
+ "Web",
+ "Television",
+ "Radio",
+ "Mail"
+ ],
"default": "Email",
+ "customizationOptionsDisabled": true,
"customizationOptionsReferenceDisabled": true
},
"startDate": {
@@ -294,8 +302,7 @@
"massEmails": {
"type": "hasMany",
"entity": "MassEmail",
- "foreign": "campaign",
- "layoutRelationshipsDisabled": true
+ "foreign": "campaign"
},
"contactsTemplate": {
"type": "belongsTo",
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json
index a956555a65..140eb85f26 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json
@@ -55,7 +55,8 @@
"view": "crm:views/mass-email/fields/email-template"
},
"campaign": {
- "type": "link"
+ "type": "link",
+ "readOnlyAfterCreate": true
},
"targetLists": {
"type": "linkMultiple",
diff --git a/client/modules/crm/src/views/campaign/record/detail-bottom.js b/client/modules/crm/src/views/campaign/record/detail-bottom.js
deleted file mode 100644
index f6f7d4b706..0000000000
--- a/client/modules/crm/src/views/campaign/record/detail-bottom.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/************************************************************************
- * 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.
- ************************************************************************/
-
-define('crm:views/campaign/record/detail-bottom', ['views/record/detail-bottom'], function (Dep) {
-
- return Dep.extend({
-
- setupPanels: function () {
- Dep.prototype.setupPanels.call(this);
-
- this.panelList.unshift({
- name: 'massEmails',
- label: this.translate('massEmails', 'links', 'Campaign'),
- view: 'views/record/panels/relationship',
- hidden: true,
- select: false,
- recordListView: 'crm:views/mass-email/record/list-for-campaign',
- rowActionsView: 'crm:views/mass-email/record/row-actions/for-campaign',
- index: -2,
- });
-
- this.panelList.unshift({
- name: 'trackingUrls',
- label: this.translate('trackingUrls', 'links', 'Campaign'),
- view: 'views/record/panels/relationship',
- hidden: true,
- select: false,
- rowActionsView: 'views/record/row-actions/relationship-no-unlink',
- index: -1,
- });
-
- this.listenTo(this.model, 'change', () => {
- this.manageMassEmails();
- });
- },
-
- afterRender: function () {
- Dep.prototype.afterRender.call(this);
-
- this.manageMassEmails();
- },
-
- manageMassEmails: function () {
- const parentView = this.getParentView();
-
- if (!parentView) {
- return;
- }
-
- if (~['Email', 'Newsletter'].indexOf(this.model.get('type'))) {
- parentView.showPanel('massEmails');
- parentView.showPanel('trackingUrls');
- } else {
- parentView.hidePanel('massEmails');
- parentView.hidePanel('trackingUrls');
- }
- },
- });
-});
diff --git a/client/modules/crm/src/views/campaign/record/detail.js b/client/modules/crm/src/views/campaign/record/detail.js
index 59f96a28e3..9ef0ebdb79 100644
--- a/client/modules/crm/src/views/campaign/record/detail.js
+++ b/client/modules/crm/src/views/campaign/record/detail.js
@@ -32,8 +32,6 @@ define('crm:views/campaign/record/detail', ['views/record/detail'], function (De
duplicateAction: true,
- bottomView: 'crm:views/campaign/record/detail-bottom',
-
setupActionItems: function () {
Dep.prototype.setupActionItems.call(this);
this.dropdownItemList.push({