EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
move dynamic logic defs
Yuriibeef74011497
diff --git a/application/Espo/Core/Templates/Metadata/Event/clientDefs.json b/application/Espo/Core/Templates/Metadata/Event/clientDefs.jsonindex 35886fe24d..6723da5730 100644--- a/application/Espo/Core/Templates/Metadata/Event/clientDefs.json+++ b/application/Espo/Core/Templates/Metadata/Event/clientDefs.json@@ -53,19 +53,5 @@"forcePatchAttributeDependencyMap": {"dateEnd": ["dateStart"],"dateEndDate": ["dateStartDate"]- },- "dynamicLogic":{- "fields":{- "duration": {- "readOnly": {- "conditionGroup": [- {- "type": "isTrue",- "attribute": "isAllDay"- }- ]- }- }- }}}diff --git a/application/Espo/Core/Templates/Metadata/Event/logicDefs.json b/application/Espo/Core/Templates/Metadata/Event/logicDefs.jsonnew file mode 100644index 0000000000..9c6347e631--- /dev/null+++ b/application/Espo/Core/Templates/Metadata/Event/logicDefs.json@@ -0,0 +1,14 @@+{+ "fields":{+ "duration": {+ "readOnly": {+ "conditionGroup": [+ {+ "type": "isTrue",+ "attribute": "isAllDay"+ }+ ]+ }+ }+ }+}diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.jsonindex b3f88c1e67..1c8f3b76ca 100644--- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json@@ -121,61 +121,6 @@"boolFilterList": ["onlyMy"],- "dynamicLogic": {- "fields": {- "name": {- "required": {- "conditionGroup": [- {- "type": "isEmpty",- "attribute": "accountName"- },- {- "type": "isEmpty",- "attribute": "emailAddress"- },- {- "type": "isEmpty",- "attribute": "phoneNumber"- }- ]- }- },- "convertedAt": {- "visible": {- "conditionGroup": [- {- "type": "and",- "value": [- {- "type": "equals",- "attribute": "status",- "value": "Converted"- },- {- "type": "isNotEmpty",- "attribute": "convertedAt"- }- ]- }- ]- }- }- },- "panels": {- "convertedTo": {- "visible": {- "conditionGroup": [- {- "type": "equals",- "attribute": "status",- "value": "Converted"- }- ]- }- }- }- },"color": "#d6a2c9","iconClass": "fas fa-address-card"}diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.jsonindex dad850db47..7b41fe2ff9 100644--- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json@@ -129,19 +129,5 @@"type": "bottomPanelsEditSmall"}},- "dynamicLogic":{- "fields": {- "duration": {- "readOnly": {- "conditionGroup": [- {- "type": "isTrue",- "attribute": "isAllDay"- }- ]- }- }- }- },"iconClass": "fas fa-calendar-check"}diff --git a/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Lead.jsonnew file mode 100644index 0000000000..46bf354728--- /dev/null+++ b/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Lead.json@@ -0,0 +1,55 @@+{+ "fields": {+ "name": {+ "required": {+ "conditionGroup": [+ {+ "type": "isEmpty",+ "attribute": "accountName"+ },+ {+ "type": "isEmpty",+ "attribute": "emailAddress"+ },+ {+ "type": "isEmpty",+ "attribute": "phoneNumber"+ }+ ]+ }+ },+ "convertedAt": {+ "visible": {+ "conditionGroup": [+ {+ "type": "and",+ "value": [+ {+ "type": "equals",+ "attribute": "status",+ "value": "Converted"+ },+ {+ "type": "isNotEmpty",+ "attribute": "convertedAt"+ }+ ]+ }+ ]+ }+ }+ },+ "panels": {+ "convertedTo": {+ "visible": {+ "conditionGroup": [+ {+ "type": "equals",+ "attribute": "status",+ "value": "Converted"+ }+ ]+ }+ }+ }+}diff --git a/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Meeting.jsonnew file mode 100644index 0000000000..6e5273f79b--- /dev/null+++ b/application/Espo/Modules/Crm/Resources/metadata/logicDefs/Meeting.json@@ -0,0 +1,14 @@+{+ "fields": {+ "duration": {+ "readOnly": {+ "conditionGroup": [+ {+ "type": "isTrue",+ "attribute": "isAllDay"+ }+ ]+ }+ }+ }+}diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.phpindex 14801755ad..fe4f166de5 100644--- a/application/Espo/Tools/EntityManager/EntityManager.php+++ b/application/Espo/Tools/EntityManager/EntityManager.php@@ -272,6 +272,7 @@ class EntityManager$this->processMetadataCreateSelectDefs($templatePath, $name, $type);$this->processMetadataCreateRecordDefs($templatePath, $name, $type);+ $this->processMetadataCreateLogicDefs($templatePath, $name, $type);$this->baseLanguage->set('Global', 'scopeNames', $name, $labelSingular);$this->baseLanguage->set('Global', 'scopeNamesPlural', $name, $labelPlural);@@ -354,6 +355,21 @@ class EntityManager$this->metadata->set('recordDefs', $name, $data);}+ private function processMetadataCreateLogicDefs(string $templatePath, string $name, string $type): void+ {+ $path = $templatePath . "/Metadata/$type/logicDefs.json";++ if (!$this->fileManager->isFile($path)) {+ return;+ }++ $contents = $this->fileManager->getContents($path);++ $data = Json::decode($contents, true);++ $this->metadata->set('logicDefs', $name, $data);+ }+/*** @param array{* stream?: bool,@@ -563,6 +579,7 @@ class EntityManager$this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/clientDefs/$name.json");$this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/recordDefs/$name.json");$this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/selectDefs/$name.json");+ $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/logicDefs/$name.json");$this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/scopes/$name.json");$this->fileManager->removeFile("custom/Espo/Custom/Entities/$normalizedName.php");