diff --git a/application/Espo/Core/Exceptions/ConflictSilent.php b/application/Espo/Core/Exceptions/ConflictSilent.php new file mode 100644 index 0000000000..45b21195df --- /dev/null +++ b/application/Espo/Core/Exceptions/ConflictSilent.php @@ -0,0 +1,35 @@ +get('convertedAt') && $entity->get('status') === 'Converted' && $entity->isAttributeChanged('status')) { + $convertedAt = date('Y-m-d H:i:s'); + $entity->set('convertedAt', $convertedAt); + } + + parent::beforeSave($entity, $options); + } + + public function afterSave(Entity $entity, array $options = []) { parent::afterSave($entity, $options); diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Lead.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Lead.json index 1e0a0f8c75..bd3218dcee 100644 --- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Lead.json +++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Lead.json @@ -22,6 +22,7 @@ "createdAccount": "Account", "createdContact": "Contact", "createdOpportunity": "Opportunity", + "convertedAt": "Converted At", "campaign": "Campaign", "targetLists": "Target Lists", "targetList": "Target List", diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json index c39e2fdd78..827936e358 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json @@ -6,6 +6,11 @@ "recordViews":{ "detail":"crm:views/lead/record/detail" }, + "defaultSidePanelFieldList": [ + ":assignedUser", + "teams", + "convertedAt" + ], "sidePanels":{ "detail":[ { @@ -132,6 +137,26 @@ } ] } + }, + "convertedAt": { + "visible": { + "conditionGroup": [ + { + "type": "and", + "value": [ + { + "type": "equals", + "attribute": "status", + "value": "Converted" + }, + { + "type": "isNotEmpty", + "attribute": "convertedAt" + } + ] + } + ] + } } }, "panels": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json index ed48db92ce..58e98f6a05 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json @@ -100,6 +100,12 @@ "description": { "type": "text" }, + "convertedAt": { + "type": "datetime", + "layoutDetailDisabled": true, + "layoutMassUpdateDisabled": true, + "readOnly": true + }, "createdAt": { "type": "datetime", "readOnly": true diff --git a/application/Espo/Resources/i18n/en_US/Settings.json b/application/Espo/Resources/i18n/en_US/Settings.json index 8cc0f1856b..f40b800393 100644 --- a/application/Espo/Resources/i18n/en_US/Settings.json +++ b/application/Espo/Resources/i18n/en_US/Settings.json @@ -91,7 +91,6 @@ "massEmailOpenTracking": "Email Open Tracking", "activitiesEntityList": "Activities Entity List", "historyEntityList": "History Entity List", - "b2cMode": "B2C Mode", "currencyFormat": "Currency Format", "currencyDecimalPlaces": "Currency Decimal Places", "aclStrictMode": "ACL Strict Mode", diff --git a/application/Espo/SelectManagers/Email.php b/application/Espo/SelectManagers/Email.php index 4eebe04449..276757c9cf 100644 --- a/application/Espo/SelectManagers/Email.php +++ b/application/Espo/SelectManagers/Email.php @@ -51,7 +51,7 @@ class Email extends \Espo\Core\SelectManagers\Base $skipIndex = true; break; } else { - if (isset($item['attribute']) && $this->getSeed()->getAttributeParam($item['attribute'], 'type') === 'foreignId') { + if (isset($item['attribute'])) { $skipIndex = true; break; } diff --git a/application/Espo/Services/EmailFilter.php b/application/Espo/Services/EmailFilter.php index bc3f9dea7f..00ea52cfea 100644 --- a/application/Espo/Services/EmailFilter.php +++ b/application/Espo/Services/EmailFilter.php @@ -41,5 +41,10 @@ class EmailFilter extends Record if (!$this->getAcl()->check($entity, 'edit')) { throw new Forbidden(); } + + if ($entity->get('isGlobal')) { + $entity->set('parentId', null); + $entity->set('parentType', null); + } } } diff --git a/application/Espo/Services/Record.php b/application/Espo/Services/Record.php index de23eeb85f..bacf965c80 100644 --- a/application/Espo/Services/Record.php +++ b/application/Espo/Services/Record.php @@ -38,6 +38,7 @@ use \Espo\Core\Exceptions\Conflict; use \Espo\Core\Exceptions\NotFound; use \Espo\Core\Exceptions\NotFoundSilent; use \Espo\Core\Exceptions\ForbiddenSilent; +use \Espo\Core\Exceptions\ConflictSilent; use \Espo\Core\Utils\Util; @@ -830,7 +831,7 @@ class Record extends \Espo\Core\Services\Base 'reason' => 'Duplicate', 'data' => $data ]; - throw new Conflict(json_encode($reason)); + throw new ConflictSilent(json_encode($reason)); } } } diff --git a/client/modules/crm/src/views/contact/fields/accounts.js b/client/modules/crm/src/views/contact/fields/accounts.js index 410e54fb47..92c434cc94 100644 --- a/client/modules/crm/src/views/contact/fields/accounts.js +++ b/client/modules/crm/src/views/contact/fields/accounts.js @@ -154,6 +154,8 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit }, addLinkHtml: function (id, name) { + name = name || id; + if (this.mode == 'search') { return Dep.prototype.addLinkHtml.call(this, id, name); } diff --git a/client/modules/crm/src/views/lead/record/panels/converted-to.js b/client/modules/crm/src/views/lead/record/panels/converted-to.js index 735483eca9..61b28deb76 100644 --- a/client/modules/crm/src/views/lead/record/panels/converted-to.js +++ b/client/modules/crm/src/views/lead/record/panels/converted-to.js @@ -43,8 +43,7 @@ Espo.define('crm:views/lead/record/panels/converted-to', 'views/record/panels/si if (this.getAcl().check('Opportunity') && !this.getMetadata().get('scopes.Opportunity.disabled')) { this.fieldList.push('createdOpportunity'); } - } + }, }); - }); diff --git a/client/res/templates/modals/image-preview.tpl b/client/res/templates/modals/image-preview.tpl index fa8c2517a3..d124e4960c 100644 --- a/client/res/templates/modals/image-preview.tpl +++ b/client/res/templates/modals/image-preview.tpl @@ -2,8 +2,6 @@ -{{#if size}} -
-{{translate 'Original'}}: {{name}} + -{{/if}} diff --git a/client/src/views/fields/link-multiple-with-columns.js b/client/src/views/fields/link-multiple-with-columns.js index 70ff43d9d7..e5ef06afea 100644 --- a/client/src/views/fields/link-multiple-with-columns.js +++ b/client/src/views/fields/link-multiple-with-columns.js @@ -106,7 +106,7 @@ Espo.define('views/fields/link-multiple-with-columns', 'views/fields/link-multip }, getDetailLinkHtml: function (id, name) { - name = name || this.nameHash[id]; + name = name || this.nameHash[id] || id; var roleHtml = ''; diff --git a/client/src/views/fields/link-multiple-with-primary.js b/client/src/views/fields/link-multiple-with-primary.js index c790478338..6f98f03699 100644 --- a/client/src/views/fields/link-multiple-with-primary.js +++ b/client/src/views/fields/link-multiple-with-primary.js @@ -123,6 +123,8 @@ Espo.define('views/fields/link-multiple-with-primary', 'views/fields/link-multip }, addLinkHtml: function (id, name) { + name = name || id; + if (this.mode == 'search') { return Dep.prototype.addLinkHtml.call(this, id, name); } @@ -130,7 +132,7 @@ Espo.define('views/fields/link-multiple-with-primary', 'views/fields/link-multip var $container = this.$el.find('.link-container'); var $el = $('