diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/MassEmail.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/MassEmail.json index f00e050d17..6b5ec712ee 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/MassEmail.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/MassEmail.json @@ -1,54 +1,75 @@ { - "controller": "controllers/record", - "acl": "crm:acl/mass-email", - "recordViews": { - "detail": "crm:views/mass-email/record/detail", - "edit": "crm:views/mass-email/record/edit", - "editQuick": "crm:views/mass-email/record/edit-small" - }, - "views": { - "detail": "crm:views/mass-email/detail" - }, - "defaultSidePanel": { - "edit": false, - "editSmall": false - }, - "formDependency": { - "status": { - "map": { - "Complete": [ - { - "action": "setReadOnly", - "fields": [ - "status" + "controller": "controllers/record", + "acl": "crm:acl/mass-email", + "recordViews": { + "detail": "crm:views/mass-email/record/detail", + "edit": "crm:views/mass-email/record/edit", + "editQuick": "crm:views/mass-email/record/edit-small" + }, + "views": { + "detail": "crm:views/mass-email/detail" + }, + "defaultSidePanel": { + "edit": false, + "editSmall": false + }, + "dynamicLogic": { + "fields": { + "status": { + "readOnly": { + "conditionGroup": [ + { + "type": "and", + "value": [ + { + "type": "or", + "value": [ + { + "type": "equals", + "attribute": "status", + "value": "Complete" + }, + { + "type": "equals", + "attribute": "status", + "value": "In Process" + }, + { + "type": "equals", + "attribute": "status", + "value": "Failed" + } + ] + }, + { + "type": "isNotEmpty", + "attribute": "id" + } + ] + } + ] + } + } + }, + "options": { + "status": [ + { + "optionList": [ + "Draft", + "Pending" + ], + "conditionGroup": [ + { + "type": "in", + "attribute": "status", + "value": [ + "Draft", + "Pending" + ] + } + ] + } ] - } - ], - "In Process": [ - { - "action": "setReadOnly", - "fields": [ - "status" - ] - } - ], - "Failed": [ - { - "action": "setReadOnly", - "fields": [ - "status" - ] - } - ] - }, - "default": [ - { - "action": "setNotReadOnly", - "fields": [ - "status" - ] } - ] } - } } \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json index 4cd542b03b..f5359540ba 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json @@ -7,7 +7,7 @@ }, "status": { "type": "enum", - "options": ["Draft", "Pending"], + "options": ["Draft", "Pending", "Complete", "In Process", "Failed"], "default": "Pending" }, "storeSentEmails": { diff --git a/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json b/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json index 85f8a96b19..d27f84c49e 100644 --- a/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json +++ b/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json @@ -129,6 +129,10 @@ "linkMultiple": { "view": "views/admin/dynamic-logic/conditions/field-types/link-multiple", "typeList": ["isEmpty", "isNotEmpty", "contains", "notContains"] + }, + "id": { + "view": "views/admin/dynamic-logic/conditions/field-types/base", + "typeList": ["isEmpty", "isNotEmpty"] } }, "conditionTypes": { diff --git a/client/src/views/admin/dynamic-logic/conditions/group-base.js b/client/src/views/admin/dynamic-logic/conditions/group-base.js index f713dcd88d..fbd083cc90 100644 --- a/client/src/views/admin/dynamic-logic/conditions/group-base.js +++ b/client/src/views/admin/dynamic-logic/conditions/group-base.js @@ -99,7 +99,15 @@ Espo.define('views/admin/dynamic-logic/conditions/group-base', 'view', function viewName = 'views/admin/dynamic-logic/conditions/' + type; } else { fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', field, 'type']); - viewName = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'fieldTypes', fieldType, 'view']); + + if (field === 'id') { + fieldType = 'id'; + } + + if (fieldType) { + viewName = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'fieldTypes', fieldType, 'view']); + } + } if (!viewName) return; @@ -170,6 +178,9 @@ Espo.define('views/admin/dynamic-logic/conditions/group-base', 'view', function addField: function (field) { var fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', field, 'type']); + if (!fieldType && field == 'id') { + fieldType = 'id'; + } if (!this.getMetadata().get(['clientDefs', 'DynamicLogic', 'fieldTypes', fieldType])) { throw new Error(); } diff --git a/client/src/views/admin/dynamic-logic/fields/field.js b/client/src/views/admin/dynamic-logic/fields/field.js index 6c2afaa92d..5ba09e3be7 100644 --- a/client/src/views/admin/dynamic-logic/fields/field.js +++ b/client/src/views/admin/dynamic-logic/fields/field.js @@ -42,6 +42,8 @@ Espo.define('views/admin/dynamic-logic/fields/field', 'views/fields/multi-enum', return true; }, this); + filterList.push('id'); + filterList.sort(function (v1, v2) { return this.translate(v1, 'fields', this.options.scope).localeCompare(this.translate(v2, 'fields', this.options.scope)); }.bind(this));