diff --git a/application/Espo/Resources/i18n/en_US/Global.json b/application/Espo/Resources/i18n/en_US/Global.json index c35ddf2bab..77045d37af 100644 --- a/application/Espo/Resources/i18n/en_US/Global.json +++ b/application/Espo/Resources/i18n/en_US/Global.json @@ -856,5 +856,18 @@ "noEmptyString": "No Empty String", "max": "Max Value", "min": "Min Value" + }, + "fieldValidationExplanations": { + "url_valid": "Invalid URL value.", + "currency_valid": "Invalid amount value.", + "currency_validCurrency": "The currency code value is invalid or not allowed.", + "varchar_pattern": "Likely, the value contains not allowed characters.", + "email_emailAddress": "Invalid email address value.", + "phone_phoneNumber": "Invalid phone number value.", + "dateTimeOptional_valid": "Invalid date-time value.", + "dateTime_valid": "Invalid date-time value.", + "date_valid": "Invalid date value.", + "enum_valid": "Invalid enum value. The value must be one of defined enum options. An empty value is allowed only if the field has an empty option.", + "multiEnum_valid": "Invalid multi-enum value. Values must be one of defined field options." } } diff --git a/application/Espo/Resources/i18n/en_US/ImportError.json b/application/Espo/Resources/i18n/en_US/ImportError.json index bafbb4fa5f..1e1c53c72a 100644 --- a/application/Espo/Resources/i18n/en_US/ImportError.json +++ b/application/Espo/Resources/i18n/en_US/ImportError.json @@ -7,7 +7,8 @@ "exportRowIndex": "Export Row Index", "lineNumber": "Line Number", "exportLineNumber": "Export Line Number", - "row": "Row" + "row": "Row", + "entityType": "Entity Type" }, "options": { "type": { diff --git a/application/Espo/Resources/metadata/entityDefs/ImportError.json b/application/Espo/Resources/metadata/entityDefs/ImportError.json index 16fd915608..cc868e223b 100644 --- a/application/Espo/Resources/metadata/entityDefs/ImportError.json +++ b/application/Espo/Resources/metadata/entityDefs/ImportError.json @@ -4,6 +4,11 @@ "type": "link", "readOnly": true }, + "entityType": { + "type": "foreign", + "link": "import", + "field": "entityType" + }, "rowIndex": { "type": "int", "readOnly": true, diff --git a/client/src/views/import-error/fields/validation-failures.js b/client/src/views/import-error/fields/validation-failures.js index e09afbf50a..14cf8f5242 100644 --- a/client/src/views/import-error/fields/validation-failures.js +++ b/client/src/views/import-error/fields/validation-failures.js @@ -37,7 +37,7 @@ define('views/import-error/fields/validation-failures', ['views/fields/base'], ( return Dep.extend(/** @lends module:views/import-error/fields/validation-failures.Class# */{ detailTemplateContent: ` - {{#if value}} + {{#if itemList.length}} @@ -46,10 +46,20 @@ define('views/import-error/fields/validation-failures', ['views/fields/base'], ( - {{#each value}} + {{#each itemList}} - + {{/each}} @@ -58,5 +68,55 @@ define('views/import-error/fields/validation-failures', ['views/fields/base'], ( {{translate 'None'}} {{/if}} `, + + data: function () { + let data = Dep.prototype.data.call(this); + + data.itemList = this.getDataList(); + + return data; + }, + + afterRenderDetail: function () { + this.$el.find('.popover-anchor').each((i, el) => { + let text = this.getHelper().transformMarkdownText(el.dataset.text); + + Espo.Ui.popover($(el), {content: text}, this); + }); + }, + + /** + * @return {Object[]} + */ + getDataList: function () { + let itemList = Espo.Utils.cloneDeep(this.model.get(this.name)) || []; + + let entityType = this.model.get('entityType'); + + if (Array.isArray(itemList)) { + itemList.forEach(item => { + /** @var {module:field-manager.Class} */ + let fieldManager = this.getFieldManager(); + /** @var {module:language.Class} */ + let language = this.getLanguage(); + + let fieldType = fieldManager.getEntityTypeFieldParam(entityType, item.field, 'type'); + + if (!fieldType) { + return; + } + + let key = fieldType + '_' + item.type; + + if (!language.has(key, 'fieldValidationExplanations', 'Global')) { + return; + } + + item.popoverText = language.translate(key, 'fieldValidationExplanations'); + }); + } + + return itemList; + }, }); });
{{translate field category='fields' scope=entityType}}{{translate type category='fieldValidations'}} + {{translate type category='fieldValidations'}} + {{#if popoverText}} + + {{/if}} +