From 1e8c5d474c9e3cf54c37c43948ff2cdedff97499 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Mon, 15 Apr 2024 16:17:34 -0400 Subject: [PATCH] fix: Logics on window and smart browse. --- .../mixinAccountingCombination.js | 14 +-- .../mixinLocationAddress.js | 16 +-- .../useProductAttribute.js | 26 ++--- .../FieldDefinition/FieldSelect/index.vue | 18 +-- .../useLocatorWarehouse.js | 14 +-- .../FieldDefinition/mixin/mixinField.js | 50 ++++---- .../mixin/mixinWithDisplayColumn.js | 32 ++--- .../FieldDefinition/useDisplayedColumn.js | 16 +-- .../FieldDefinition/useFieldDefinition.js | 38 +++--- .../ADempiere/dictionary/browser/actions.js | 60 +++++----- .../ADempiere/dictionary/browser/getters.js | 24 ++-- .../ADempiere/dictionary/window/actions.js | 22 ++-- .../modules/ADempiere/fieldDefinition.js | 6 +- src/store/modules/ADempiere/panel/actions.js | 79 ++++++------- .../ADempiere/contextUtils/contextField.js | 41 +++---- src/utils/ADempiere/dictionary/browser.js | 12 +- src/utils/ADempiere/dictionary/form/index.js | 8 +- src/utils/ADempiere/dictionary/panel.js | 20 ++-- src/utils/ADempiere/dictionary/process.js | 2 +- .../ADempiere/dictionary/window/index.js | 110 +++++++++--------- src/utils/ADempiere/dictionaryUtils.js | 16 +-- src/utils/ADempiere/lookupFactory.js | 10 +- src/views/ADempiere/Browser/index.vue | 9 +- 23 files changed, 329 insertions(+), 314 deletions(-) diff --git a/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/mixinAccountingCombination.js b/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/mixinAccountingCombination.js index c56741bc370..8b004ad1421 100644 --- a/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/mixinAccountingCombination.js +++ b/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/mixinAccountingCombination.js @@ -42,8 +42,8 @@ export default { return { parentUuid: undefined, containerUuid: undefined, - columnName: COLUMN_NAME, - elementName: COLUMN_NAME + column_name: COLUMN_NAME, + element_name: COLUMN_NAME } } } @@ -52,10 +52,10 @@ export default { computed: { blankValues() { return { - [this.metadata.columnName]: undefined, - [this.metadata.elementName]: undefined, - [DISPLAY_COLUMN_PREFIX + this.metadata.columnName]: undefined, - [DISPLAY_COLUMN_PREFIX + this.metadata.elementName]: undefined, + [this.metadata.column_name]: undefined, + [this.metadata.element_name]: undefined, + [DISPLAY_COLUMN_PREFIX + this.metadata.column_name]: undefined, + [DISPLAY_COLUMN_PREFIX + this.metadata.element_name]: undefined, uuid: undefined, UUID: undefined } @@ -128,7 +128,7 @@ export default { containerUuid: this.metadata.containerUuid, containerManager: this.containerManager, field: this.metadata, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, newValue: value }) } diff --git a/src/components/ADempiere/FieldDefinition/FieldLocationAddress/mixinLocationAddress.js b/src/components/ADempiere/FieldDefinition/FieldLocationAddress/mixinLocationAddress.js index 0a7816d5a37..03e7347b5ab 100644 --- a/src/components/ADempiere/FieldDefinition/FieldLocationAddress/mixinLocationAddress.js +++ b/src/components/ADempiere/FieldDefinition/FieldLocationAddress/mixinLocationAddress.js @@ -47,7 +47,7 @@ export default { computed: { uuidForm() { if (!isEmptyValue(this.metadata.containerUuid)) { - return this.metadata.columnName + '_' + this.metadata.containerUuid + return this.metadata.column_name + '_' + this.metadata.containerUuid } return LOCATION_ADDRESS_FORM }, @@ -64,8 +64,8 @@ export default { }, blankValues() { return { - [this.metadata.columnName]: undefined, - [this.metadata.elementName]: undefined, + [this.metadata.column_name]: undefined, + [this.metadata.element_name]: undefined, id: undefined, uuid: undefined, UUID: undefined, @@ -195,8 +195,8 @@ export default { }) newFieldsList.forEach(field => { - const { columnName } = field - const displayColumnName = DISPLAY_COLUMN_PREFIX + columnName + const { column_name } = field + const displayColumnName = DISPLAY_COLUMN_PREFIX + column_name let currrentValue = '' if (!isEmptyValue(entityValues[displayColumnName])) { @@ -204,10 +204,10 @@ export default { } if (isEmptyValue(currrentValue)) { - if (columnName === 'C_City_ID') { + if (column_name === 'C_City_ID') { currrentValue = entityValues['City'] } - if (columnName === 'C_Region_ID') { + if (column_name === 'C_Region_ID') { currrentValue = entityValues['RegionName'] } @@ -219,7 +219,7 @@ export default { } } if (isEmptyValue(currrentValue)) { - currrentValue = entityValues[columnName] + currrentValue = entityValues[column_name] } addDisplayValue(currrentValue) diff --git a/src/components/ADempiere/FieldDefinition/FieldProductAttribute/useProductAttribute.js b/src/components/ADempiere/FieldDefinition/FieldProductAttribute/useProductAttribute.js index 45744f456f9..bdb3ecde030 100644 --- a/src/components/ADempiere/FieldDefinition/FieldProductAttribute/useProductAttribute.js +++ b/src/components/ADempiere/FieldDefinition/FieldProductAttribute/useProductAttribute.js @@ -1,6 +1,6 @@ /** * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution -* Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com +* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com * Contributor(s): Elsio Sanchez elsiosanchez@gmail.com https://github.com/elsiosanchez * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,9 +35,9 @@ export default ({ const blankValues = computed(() => { return { [fieldAttributes.columnName]: undefined, - [fieldAttributes.elementName]: undefined, + [fieldAttributes.element_name]: undefined, [DISPLAY_COLUMN_PREFIX + fieldAttributes.columnName]: undefined, - [DISPLAY_COLUMN_PREFIX + fieldAttributes.elementName]: undefined, + [DISPLAY_COLUMN_PREFIX + fieldAttributes.element_name]: undefined, id: undefined, uuid: undefined, UUID: undefined, @@ -65,14 +65,12 @@ export default ({ function setValues(row) { const { id, uuid, description } = row - const { parentUuid, containerUuid } = fieldAttributes - - const columnName = fieldAttributes.columnName + const { parentUuid, containerUuid, column_name } = fieldAttributes store.commit('updateValueOfField', { parentUuid, containerUuid, - columnName, + columnName: column_name, value: id }) // set display column (name) value @@ -80,14 +78,14 @@ export default ({ parentUuid, containerUuid, // DisplayColumn_'ColumnName' - columnName: DISPLAY_COLUMN_PREFIX + columnName, + columnName: DISPLAY_COLUMN_PREFIX + column_name, value: description }) // set UUID value store.commit('updateValueOfField', { parentUuid, containerUuid, - columnName: columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + columnName: column_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, value: uuid }) // update element column name @@ -95,7 +93,7 @@ export default ({ store.commit('updateValueOfField', { parentUuid, containerUuid, - columnName: fieldAttributes.elementName, + columnName: fieldAttributes.element_name, value: id }) // set display column (name) value @@ -103,7 +101,7 @@ export default ({ parentUuid, containerUuid, // DisplayColumn_'ColumnName' - columnName: DISPLAY_COLUMN_PREFIX + fieldAttributes.elementName, + columnName: DISPLAY_COLUMN_PREFIX + fieldAttributes.element_name, value: description }) } @@ -113,13 +111,13 @@ export default ({ containerManager.setCell({ containerUuid, rowIndex: fieldAttributes.rowIndex, - columnName, + columnName: column_name, value: id }) containerManager.setCell({ containerUuid, rowIndex: fieldAttributes.rowIndex, - columnName: DISPLAY_COLUMN_PREFIX + columnName, + columnName: DISPLAY_COLUMN_PREFIX + column_name, value: description }) } @@ -128,7 +126,7 @@ export default ({ containerUuid, containerManager, field: fieldAttributes, - columnName + columnName: column_name }) } diff --git a/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue b/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue index 97ab794f143..188a8643d5b 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue @@ -112,7 +112,7 @@ export default { value: { get() { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { // implement container manager row @@ -120,7 +120,7 @@ export default { return this.containerManager.getCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName + columnName: column_name }) } } @@ -128,11 +128,11 @@ export default { return this.$store.getters.getValueOfFieldOnContainer({ parentUuid: this.metadata.parentUuid, containerUuid, - columnName + columnName: column_name }) }, set(value) { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { @@ -141,7 +141,7 @@ export default { this.containerManager.setCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName, + columnName: column_name, value }) } @@ -154,7 +154,7 @@ export default { this.$store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName, + columnName: column_name, value }) // update element column name @@ -162,7 +162,7 @@ export default { this.$store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName: this.metadata.elementName, + columnName: this.metadata.element_name, value }) } @@ -383,7 +383,7 @@ export default { id: this.metadata.id, // tableName: this.metadata.reference.table_name, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, columnUuid: this.metadata.columnUuid, searchValue: searchQuery, referenceUuid: this.metadata.reference.uuid, @@ -411,7 +411,7 @@ export default { uuid: this.metadata.uuid, // tableName: this.metadata.reference.table_name, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: this.value }) .then(() => { diff --git a/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/useLocatorWarehouse.js b/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/useLocatorWarehouse.js index a8838f6dcea..71cef13d45c 100644 --- a/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/useLocatorWarehouse.js +++ b/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/useLocatorWarehouse.js @@ -48,10 +48,10 @@ export default ({ const blankValues = computed(() => { return { - [fieldAttributes.columnName]: undefined, - [fieldAttributes.elementName]: undefined, - [DISPLAY_COLUMN_PREFIX + fieldAttributes.columnName]: undefined, - [DISPLAY_COLUMN_PREFIX + fieldAttributes.elementName]: undefined, + [fieldAttributes.column_name]: undefined, + [fieldAttributes.element_name]: undefined, + [DISPLAY_COLUMN_PREFIX + fieldAttributes.column_name]: undefined, + [DISPLAY_COLUMN_PREFIX + fieldAttributes.element_name]: undefined, id: undefined, uuid: undefined, UUID: undefined, @@ -61,7 +61,7 @@ export default ({ const uuidForm = computed(() => { if (!isEmptyValue(fieldAttributes.containerUuid)) { - return fieldAttributes.columnName + '_' + containerUuid + return fieldAttributes.column_name + '_' + containerUuid } return 'Warehouse-Locator-Form' }) @@ -120,7 +120,7 @@ export default ({ // const { parentUuid, containerUuid } = fieldAttributes - const columnName = fieldAttributes.columnName + const { column_name } = fieldAttributes // set ID value value.value = id @@ -135,7 +135,7 @@ export default ({ containerUuid, containerManager, field: fieldAttributes, - columnName + columnName: column_name }) } diff --git a/src/components/ADempiere/FieldDefinition/mixin/mixinField.js b/src/components/ADempiere/FieldDefinition/mixin/mixinField.js index 1ea60917ff2..a428d270138 100644 --- a/src/components/ADempiere/FieldDefinition/mixin/mixinField.js +++ b/src/components/ADempiere/FieldDefinition/mixin/mixinField.js @@ -62,7 +62,7 @@ export default { disabled: this.isDisabled, placeholder: this.metadata.placeholder, readonly: Boolean(this.metadata.readonly), - ref: this.metadata.columnName + ref: this.metadata.column_name } }, cssClassCustomField() { @@ -106,7 +106,7 @@ export default { }, value: { get() { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { // implement container manager row @@ -114,7 +114,7 @@ export default { const value = this.containerManager.getCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName + columnName: column_name }) // types `decimal` and `date` is a object struct if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) { @@ -127,7 +127,7 @@ export default { const value = store.getters.getValueOfFieldOnContainer({ parentUuid: this.metadata.parentUuid, containerUuid, - columnName + columnName: column_name }) // types `decimal` and `date` is a object struct if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) { @@ -136,7 +136,7 @@ export default { return value }, set(newValue) { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { @@ -145,7 +145,7 @@ export default { this.containerManager.setCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName, + columnName: column_name, value: newValue }) } @@ -154,7 +154,7 @@ export default { store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName, + columnName: column_name, value: newValue }) // update element column name @@ -162,7 +162,7 @@ export default { store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName: this.metadata.elementName, + columnName: this.metadata.element_name, value: newValue }) } @@ -195,7 +195,7 @@ export default { !isEmptyValue(fieldFocusColumnName) && !isEmptyValue(tabPanel) && fieldFocusColumnName && - this.metadata.columnName === fieldFocusColumnName && + this.metadata.column_name === fieldFocusColumnName && tabPanel.currentTab.containerUuid === this.metadata.containerUuid && !isEmptyValue(this.$refs) && !isEmptyValue(this.$refs[fieldFocusColumnName]) && @@ -253,7 +253,7 @@ export default { // uuid: this.metadata.uuid, id: this.metadata.id, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: this.value }) } @@ -299,8 +299,8 @@ export default { * Set focus if handle focus attribute is true */ requestFocus() { - if (this.$refs[this.metadata.columnName]) { - this.$refs[this.metadata.columnName].focus() + if (this.$refs[this.metadata.column_name]) { + this.$refs[this.metadata.column_name].focus() } }, /** @@ -313,10 +313,10 @@ export default { }, focusGained(value) { // const info = { - // columnName: this.metadata.columnName + // columnName: this.metadata.column_name // } // store.dispatch('fieldListInfo', { info }) - store.commit('setFieldFocusColumnName', this.metadata.columnName) + store.commit('setFieldFocusColumnName', this.metadata.column_name) if (this.metadata.handleContentSelection) { // select all the content inside the text box @@ -329,18 +329,18 @@ export default { if (this.metadata.handleFocusGained) { store.dispatch('notifyFocusGained', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: this.value }) } this.setContainerInformation() }, focusLost(value) { - store.commit('setFieldFocusColumnName', this.metadata.columnName) + store.commit('setFieldFocusColumnName', this.metadata.column_name) if (this.metadata.handleFocusLost) { store.dispatch('notifyFocusLost', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: this.value }) } @@ -349,7 +349,7 @@ export default { if (this.metadata.handleKeyPressed) { store.dispatch('notifyKeyPressed', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: value.key, keyCode: value.keyCode }) @@ -363,7 +363,7 @@ export default { if (this.metadata.handleActionKeyPerformed) { store.dispatch('notifyActionKeyPerformed', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: event.target.value, keyCode: event.keyCode }) @@ -375,7 +375,7 @@ export default { if (this.metadata.handleKeyReleased) { store.dispatch('notifyKeyReleased', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value: value.key, keyCode: value.keyCode }) @@ -414,22 +414,22 @@ export default { }) { // Global Action performed const info = { - columnName: this.metadata.columnName + columnName: this.metadata.column_name } store.dispatch('fieldListInfo', { info }) this.setContainerInformation() - store.commit('setFieldFocusColumnName', this.metadata.columnName) + store.commit('setFieldFocusColumnName', this.metadata.column_name) if (this.metadata.handleActionPerformed && this.autoSave) { store.dispatch('notifyActionPerformed', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.columnName, + columnName: this.metadata.column_name, value }) if (!this.metadata.isSameColumnElement) { store.dispatch('notifyActionPerformed', { containerUuid: this.metadata.containerUuid, - columnName: this.metadata.elementName, + columnName: this.metadata.element_name, value }) } @@ -451,7 +451,7 @@ export default { containerUuid: this.metadata.containerUuid, containerManager: this.containerManager, field: this.metadata, - columnName: this.metadata.columnName + columnName: this.metadata.column_name }) }, diff --git a/src/components/ADempiere/FieldDefinition/mixin/mixinWithDisplayColumn.js b/src/components/ADempiere/FieldDefinition/mixin/mixinWithDisplayColumn.js index f7ce3506c0f..931c6a8fca4 100644 --- a/src/components/ADempiere/FieldDefinition/mixin/mixinWithDisplayColumn.js +++ b/src/components/ADempiere/FieldDefinition/mixin/mixinWithDisplayColumn.js @@ -1,6 +1,6 @@ /** * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution - * Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ export default { computed: { value: { get() { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { // implement container manager row @@ -42,7 +42,7 @@ export default { const value = this.containerManager.getCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName + columnName: column_name }) if (!isEmptyValue(value)) { return value @@ -53,11 +53,11 @@ export default { return store.getters.getValueOfFieldOnContainer({ parentUuid: this.metadata.parentUuid, containerUuid, - columnName + columnName: column_name }) }, set(newValue) { - const { columnName, containerUuid, inTable } = this.metadata + const { column_name, containerUuid, inTable } = this.metadata // table records values if (inTable) { @@ -66,7 +66,7 @@ export default { this.containerManager.setCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName, + columnName: column_name, value: newValue }) } @@ -75,7 +75,7 @@ export default { store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName, + columnName: column_name, value: newValue }) // update element column name @@ -83,7 +83,7 @@ export default { store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName: this.metadata.elementName, + columnName: this.metadata.element_name, value: newValue }) } @@ -101,7 +101,7 @@ export default { } } - const { displayColumnName: columnName, containerUuid, inTable, display_type } = this.metadata + const { displayColumnName, containerUuid, inTable, display_type } = this.metadata if (isEmptyValue(this.value) && display_type === IMAGE.id) { return undefined @@ -115,7 +115,7 @@ export default { const value = this.containerManager.getCell({ containerUuid, rowIndex: this.metadata.rowIndex, - columnName + columnName: displayColumnName }) if (!isEmptyValue(value)) { return value @@ -126,12 +126,12 @@ export default { // return store.getters.getValueOfFieldOnContainer({ // parentUuid: this.metadata.parentUuid, // containerUuid, - // columnName + // columnName: displayColumnName // }) return store.getters.getValueOfField({ // parentUuid: this.metadata.parentUuid, containerUuid, - columnName + columnName: displayColumnName }) }, set(newValue) { @@ -162,7 +162,7 @@ export default { store.commit('updateValueOfField', { parentUuid: this.metadata.parentUuid, containerUuid, - columnName: DISPLAY_COLUMN_PREFIX + this.metadata.elementName, + columnName: DISPLAY_COLUMN_PREFIX + this.metadata.element_name, value: newValue }) } @@ -175,7 +175,7 @@ export default { parentUuid: this.metadata.parentUuid, containerUuid: this.metadata.containerUuid, // 'ColumnName'_UUID - columnName: this.metadata.columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX + columnName: this.metadata.column_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX }) }, set(value) { @@ -185,7 +185,7 @@ export default { parentUuid, containerUuid, // 'ColumnName'_UUID - columnName: this.metadata.columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + columnName: this.metadata.column_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, value }) // update element column name @@ -193,7 +193,7 @@ export default { store.commit('updateValueOfField', { parentUuid, containerUuid, - columnName: this.metadata.elementName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + columnName: this.metadata.element_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, value }) } diff --git a/src/components/ADempiere/FieldDefinition/useDisplayedColumn.js b/src/components/ADempiere/FieldDefinition/useDisplayedColumn.js index 6eb245c441b..62d621fd33a 100644 --- a/src/components/ADempiere/FieldDefinition/useDisplayedColumn.js +++ b/src/components/ADempiere/FieldDefinition/useDisplayedColumn.js @@ -53,7 +53,7 @@ export default ({ fieldMetadata, containerManager }) => { } // DisplayColumn_'ColumnName' - const { displayColumnName: columnName, containerUuid, inTable } = fieldMetadata + const { displayColumnName, containerUuid, inTable } = fieldMetadata // table records values if (inTable) { // implement container manager row @@ -61,7 +61,7 @@ export default ({ fieldMetadata, containerManager }) => { const currentValue = containerManager.getCell({ containerUuid, rowIndex: fieldMetadata.rowIndex, - columnName + columnName: displayColumnName }) if (!isEmptyValue(currentValue)) { return currentValue @@ -72,12 +72,12 @@ export default ({ fieldMetadata, containerManager }) => { // return store.getters.getValueOfFieldOnContainer({ // parentUuid: fieldMetadata.parentUuid, // containerUuid, - // columnName + // columnName: displayColumnName // }) return store.getters.getValueOfField({ // parentUuid: fieldMetadata.parentUuid, containerUuid, - columnName + columnName: displayColumnName }) }, set(newValue) { @@ -108,7 +108,7 @@ export default ({ fieldMetadata, containerManager }) => { store.commit('updateValueOfField', { parentUuid: fieldMetadata.parentUuid, containerUuid, - columnName: DISPLAY_COLUMN_PREFIX + fieldMetadata.elementName, + columnName: DISPLAY_COLUMN_PREFIX + fieldMetadata.element_name, value: newValue }) } @@ -121,7 +121,7 @@ export default ({ fieldMetadata, containerManager }) => { parentUuid: fieldMetadata.parentUuid, containerUuid: fieldMetadata.containerUuid, // 'ColumnName'_UUID - columnName: fieldMetadata.columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX + columnName: fieldMetadata.column_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX }) }, set(value) { @@ -131,7 +131,7 @@ export default ({ fieldMetadata, containerManager }) => { parentUuid, containerUuid, // 'ColumnName'_UUID - columnName: fieldMetadata.columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + columnName: fieldMetadata.column_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, value }) // update element column name @@ -139,7 +139,7 @@ export default ({ fieldMetadata, containerManager }) => { store.commit('updateValueOfField', { parentUuid, containerUuid, - columnName: fieldMetadata.elementName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + columnName: fieldMetadata.element_name + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, value }) } diff --git a/src/components/ADempiere/FieldDefinition/useFieldDefinition.js b/src/components/ADempiere/FieldDefinition/useFieldDefinition.js index f7101e00be3..14f106d8bd7 100644 --- a/src/components/ADempiere/FieldDefinition/useFieldDefinition.js +++ b/src/components/ADempiere/FieldDefinition/useFieldDefinition.js @@ -79,13 +79,13 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) disabled: isDisabled.value, placeholder: fieldMetadata.placeholder, readonly: Boolean(fieldMetadata.readonly), - ref: fieldMetadata.columnName + ref: fieldMetadata.column_name } }) const value = computed({ get() { - const { columnName, containerUuid, inTable } = fieldMetadata + const { column_name, containerUuid, inTable } = fieldMetadata // table records values if (inTable) { @@ -94,7 +94,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) const value = containerManager.getCell({ containerUuid, rowIndex: fieldMetadata.rowIndex, - columnName + columnName: column_name }) // types `decimal` and `date` is a object struct if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) { @@ -108,7 +108,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) const value = store.getters.getValueOfFieldOnContainer({ parentUuid: fieldMetadata.parentUuid, containerUuid, - columnName + columnName: column_name }) // types `decimal` and `date` is a object struct if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) { @@ -117,7 +117,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) return value }, set(newValue) { - const { columnName, containerUuid, inTable } = fieldMetadata + const { column_name, containerUuid, inTable } = fieldMetadata // table records values if (inTable) { @@ -126,7 +126,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) return containerManager.setCell({ containerUuid, rowIndex: fieldMetadata.rowIndex, - columnName, + columnName: column_name, value: newValue }) } @@ -135,14 +135,14 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) store.commit('updateValueOfField', { parentUuid: fieldMetadata.parentUuid, containerUuid, - columnName, + columnName: column_name, value: newValue }) if (!fieldMetadata.isSameColumnElement) { store.commit('updateValueOfField', { parentUuid: fieldMetadata.parentUuid, containerUuid, - columnName: fieldMetadata.elementName, + columnName: fieldMetadata.element_name, value: newValue }) } @@ -196,7 +196,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) // uuid: fieldMetadata.uuid, id: fieldMetadata.id, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: value.value }) } @@ -214,8 +214,8 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) * TODO: Add support with composition api */ function requestFocus() { - // if (this.$refs[fieldMetadata.columnName]) { - // this.$refs[fieldMetadata.columnName].focus() + // if (this.$refs[fieldMetadata.column_name]) { + // this.$refs[fieldMetadata.column_name].focus() // } } @@ -231,7 +231,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleFocusGained) { store.dispatch('notifyFocusGained', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: event.value }) } @@ -241,7 +241,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleFocusLost) { store.dispatch('notifyFocusLost', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: event.value }) } @@ -251,7 +251,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleKeyPressed) { store.dispatch('notifyKeyPressed', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: event.key, keyCode: event.keyCode }) @@ -266,7 +266,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleActionKeyPerformed) { store.dispatch('notifyActionKeyPerformed', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: event.target.value, keyCode: event.keyCode }) @@ -279,7 +279,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleKeyReleased) { store.dispatch('notifyKeyReleased', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value: event.key, keyCode: event.keyCode }) @@ -328,13 +328,13 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) if (fieldMetadata.handleActionPerformed && autoSave.value) { store.dispatch('notifyActionPerformed', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.columnName, + columnName: fieldMetadata.column_name, value }) if (!fieldMetadata.isSameColumnElement) { store.dispatch('notifyActionPerformed', { containerUuid: fieldMetadata.containerUuid, - columnName: fieldMetadata.elementName, + columnName: fieldMetadata.element_name, value }) } @@ -352,7 +352,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) containerUuid: fieldMetadata.containerUuid, containerManager, field: fieldMetadata, - columnName: fieldMetadata.columnName + columnName: fieldMetadata.column_name }) } diff --git a/src/store/modules/ADempiere/dictionary/browser/actions.js b/src/store/modules/ADempiere/dictionary/browser/actions.js index 07da55aeda6..8472901ebf2 100644 --- a/src/store/modules/ADempiere/dictionary/browser/actions.js +++ b/src/store/modules/ADempiere/dictionary/browser/actions.js @@ -51,7 +51,8 @@ import { templateBrowser } from '@/utils/ADempiere/dictionary/browser/templateBr export default { getBrowserDefinitionFromServer({ commit, state, dispatch, rootGetters }, { id, - parentUuid = '' // context of associated + parentUuid = '', // context of associated + containerUuid = '' // context of associated }) { return new Promise(resolve => { const language = rootGetters['getCurrentLanguage'] @@ -68,6 +69,11 @@ export default { .then(browserResponse => { const browser = templateBrowser(browserResponse) const browserUuid = browser.uuid + commit('addBrowserUuidToList', { + id: browser.id, + uuid: browserUuid + }) + const browserDefinition = generatePanelAndFields({ containerUuid: browserUuid, panelMetadata: { @@ -85,11 +91,11 @@ export default { browserDefinition.elementsList = {} browserDefinition.columnsList = {} browserDefinition.fieldsList.forEach(fieldItem => { - browserDefinition.elementsList[fieldItem.columnName] = fieldItem.elementName - browserDefinition.columnsList[fieldItem.elementName] = fieldItem.columnName + browserDefinition.elementsList[fieldItem.column_name] = fieldItem.element_name + browserDefinition.columnsList[fieldItem.element_name] = fieldItem.column_name if (isLookup(fieldItem.display_type)) { - browserDefinition.elementsList[DISPLAY_COLUMN_PREFIX + fieldItem.columnName] = DISPLAY_COLUMN_PREFIX + fieldItem.elementName - browserDefinition.columnsList[DISPLAY_COLUMN_PREFIX + fieldItem.elementName] = DISPLAY_COLUMN_PREFIX + fieldItem.columnName + browserDefinition.elementsList[DISPLAY_COLUMN_PREFIX + fieldItem.column_name] = DISPLAY_COLUMN_PREFIX + fieldItem.element_name + browserDefinition.columnsList[DISPLAY_COLUMN_PREFIX + fieldItem.element_name] = DISPLAY_COLUMN_PREFIX + fieldItem.column_name } if (fieldItem.is_range) { @@ -99,10 +105,6 @@ export default { }) commit('addBrowserToList', browserDefinition) - commit('addBrowserUuidToList', { - id: browserDefinition.id, - uuid: browserUuid - }) dispatch('setBrowserActionsMenu', { parentUuid, @@ -114,10 +116,13 @@ export default { containerUuid: browserUuid, fieldsList: browserDefinition.fieldsList }) + // set parent context - if (!isEmptyValue(parentUuid)) { + if (!isEmptyValue(parentUuid) || !isEmptyValue(containerUuid)) { const parentContext = rootGetters.getValuesView({ - parentUuid + parentUuid, + containerUuid, + format: 'object' }) dispatch('updateValuesOfContainer', { containerUuid: browserUuid, @@ -125,20 +130,22 @@ export default { }) browserDefinition.fieldsList.forEach(itemField => { - if (!itemField.isSameColumnElement) { - const currentValueElement = parentContext.find(itemAttribute => { - return itemAttribute.columnName === itemField.elementName - }) - if (!isEmptyValue(currentValueElement) && !isEmptyValue(currentValueElement.value)) { + const { isSameColumnElement, column_name, element_name } = itemField + if (!isSameColumnElement) { + // const currentContextValue = parentContext.find(itemAttribute => { + // return itemAttribute.columnName === itemField.element_name + // }) + const currentContextValue = parentContext[element_name] + if (!isEmptyValue(currentContextValue)) { commit('updateValueOfField', { containerUuid: browserUuid, - columnName: itemField.elementName, - value: currentValueElement.value + columnName: element_name, + value: currentContextValue }) commit('updateValueOfField', { containerUuid: browserUuid, - columnName: itemField.columnName, - value: currentValueElement.value + columnName: column_name, + value: currentContextValue }) } // change Dependents @@ -154,8 +161,6 @@ export default { const { process } = browserDefinition if (!isEmptyValue(process)) { - // get browser definition - dispatch('setModalDialog', { containerUuid: process.uuid, title: process.name, @@ -174,7 +179,7 @@ export default { } store.dispatch('startProcessOfBrowser', { - parentUuid: browserUuid, + parentUuid: browserDefinition.uuid, containerUuid: process.uuid }).then(processOutputResponse => { // close current page @@ -261,6 +266,7 @@ export default { } actionsList.push(actionProcess) } + actionsList.push(runDeleteable) // export selected records @@ -364,9 +370,9 @@ export default { let fieldChangedDisplayedWithValue = false fieldsList.forEach(itemField => { - const { columnName } = itemField + const { column_name } = itemField - const isShowedFromUser = fieldsShowed.includes(columnName) + const isShowedFromUser = fieldsShowed.includes(column_name) if (itemField.isShowedFromUser === isShowedFromUser) { // no to mutate the state unnecessarily return @@ -386,7 +392,7 @@ export default { if (!fieldChangedDisplayedWithValue) { const value = rootGetters.getValueOfField({ containerUuid, - columnName + columnName: column_name }) // if isShowedFromUser was changed with value, the SmartBrowser // must send the parameters to update the search result @@ -419,7 +425,7 @@ export default { } fieldsList.forEach(itemField => { - const isShowedTableFromUser = fieldsShowed.includes(itemField.columnName) + const isShowedTableFromUser = fieldsShowed.includes(itemField.column_name) if (itemField.isShowedTableFromUser === isShowedTableFromUser) { // no to mutate the state unnecessarily return diff --git a/src/store/modules/ADempiere/dictionary/browser/getters.js b/src/store/modules/ADempiere/dictionary/browser/getters.js index 5d22a5d002f..9aaa58cd80c 100644 --- a/src/store/modules/ADempiere/dictionary/browser/getters.js +++ b/src/store/modules/ADempiere/dictionary/browser/getters.js @@ -54,8 +54,8 @@ export default { const columnsList = [] if (!isEmptyValue(browser)) { browser.fieldsList.forEach(field => { - columnsList.push(field.columnName) - columnsList.push(field.elementName) + columnsList.push(field.column_name) + columnsList.push(field.element_name) }) return columnsList } @@ -84,11 +84,11 @@ export default { const queryParams = [] fieldsList.forEach(fieldItem => { - const { columnName, elementName } = fieldItem - const isMandatory = isMandatoryField(fieldItem) + const { column_name, element_name } = fieldItem + const isMandatoryGenerated = isMandatoryField(fieldItem) // evaluate displayed fields const isDisplayed = isDisplayedField(fieldItem) && - (fieldItem.isShowedFromUser || isMandatory) + (fieldItem.isShowedFromUser || isMandatoryGenerated) if (!isDisplayed) { return @@ -96,7 +96,7 @@ export default { const value = rootGetters.getValueOfField({ containerUuid, - columnName + columnName: column_name }) if (fieldItem.is_range && !isNumberField(fieldItem.display_type)) { @@ -114,7 +114,7 @@ export default { if (!isEmptyValue(value)) { queryParams.push({ - columnName: elementName, + columnName: element_name, value }) } @@ -141,7 +141,7 @@ export default { fieldsList.forEach(fieldItem => { // default operator - const { is_info_only, columnName, columnNameTo, operator, display_type } = fieldItem + const { is_info_only, column_name, columnNameTo, operator, display_type } = fieldItem if (is_info_only) { return false } @@ -156,7 +156,7 @@ export default { const contextValue = rootGetters.getValueOfField({ containerUuid: containerUuid, - columnName: columnName + columnName: column_name }) const isNullOperator = IGNORE_VALUE_OPERATORS_LIST.includes(operator) @@ -195,7 +195,7 @@ export default { if (!isEmptyValue(value) || isNullOperator) { queryParams.push({ - columnName, + columnName: column_name, operator, value, valueTo, @@ -344,7 +344,7 @@ export default { } return fieldsList.find(itemField => { - return itemField.columnName === columnName + return itemField.column_name === columnName }) }, @@ -361,7 +361,7 @@ export default { } return fieldsList.find(itemField => { - return itemField.elementName === columnName + return itemField.element_name === columnName }) } diff --git a/src/store/modules/ADempiere/dictionary/window/actions.js b/src/store/modules/ADempiere/dictionary/window/actions.js index be0828ad176..5ce2e1e1e53 100644 --- a/src/store/modules/ADempiere/dictionary/window/actions.js +++ b/src/store/modules/ADempiere/dictionary/window/actions.js @@ -156,8 +156,8 @@ export default { return fieldItem.columnName }) - if (!isEmptyValue(tabDefinition.parentColumn)) { - relatedColumns = relatedColumns.push(tabDefinition.parentColumn) + if (!isEmptyValue(tabDefinition.parent_column_name)) { + relatedColumns = relatedColumns.push(tabDefinition.parent_column_name) } relatedColumns = relatedColumns.concat(parentColumns).sort() @@ -478,14 +478,14 @@ export default { let displayed = ({ containerUuid, parentUuid }) => { return true } - if (fieldAssociated && !isEmptyValue(fieldAssociated.displayLogic)) { + if (fieldAssociated && !isEmptyValue(fieldAssociated.display_logic)) { displayed = ({ parentUuid, containerUuid }) => { // evaluate display logic of field with process associated to hidden/showed const isDisplayedFromLogic = evaluator.evaluateLogic({ parentUuid, containerUuid, context: getContext, - logic: fieldAssociated.displayLogic + logic: fieldAssociated.display_logic }) return isDisplayedFromLogic } @@ -642,9 +642,9 @@ export default { fieldsList.forEach(itemField => { if (groupField === itemField.groupAssigned) { - const { columnName } = itemField + const { column_name } = itemField - const isShowedFromUser = fieldsShowed.includes(columnName) + const isShowedFromUser = fieldsShowed.includes(column_name) if (itemField.isShowedFromUser === isShowedFromUser) { // no to mutate the state unnecessarily return @@ -679,7 +679,7 @@ export default { fieldsList.forEach(itemField => { if (groupField === itemField.groupAssigned) { - const isShowedTableFromUser = fieldsShowed.includes(itemField.columnName) + const isShowedTableFromUser = fieldsShowed.includes(itemField.column_name) commit('changeTabFieldAttribute', { field: itemField, @@ -779,7 +779,7 @@ export default { if (!isEmptyValue(parsedFilters)) { // merge values defaultAttributes = defaultAttributes.map(attribute => { - const filterValue = parsedFilters[attribute.columnName] + const filterValue = parsedFilters[attribute.column_name] return { ...attribute, value: filterValue @@ -795,7 +795,7 @@ export default { // with copy values if (!isEmptyValue(overwriteValues)) { defaultAttributes = defaultAttributes.map(attribute => { - const filterValue = overwriteValues[attribute.columnName] + const filterValue = overwriteValues[attribute.column_name] if (isEmptyValue(filterValue)) { return attribute } @@ -828,7 +828,7 @@ export default { if (tab.table.is_document) { // get displayed value on status const fieldDocumentStatus = tab.fieldsList.find(field => { - return field.columnName === DOCUMENT_STATUS + return field.column_name === DOCUMENT_STATUS }) if (!isEmptyValue(fieldDocumentStatus)) { const value = getDocumentStatusValue({ @@ -850,7 +850,7 @@ export default { // uuid: fieldDocumentStatus.uuid, id: fieldDocumentStatus.id, - columnName: fieldDocumentStatus.columnName, + columnName: fieldDocumentStatus.column_name, defaultValue: fieldDocumentStatus.default_value, value: value }) diff --git a/src/store/modules/ADempiere/fieldDefinition.js b/src/store/modules/ADempiere/fieldDefinition.js index 0c2771dd932..d537053c21a 100644 --- a/src/store/modules/ADempiere/fieldDefinition.js +++ b/src/store/modules/ADempiere/fieldDefinition.js @@ -103,7 +103,7 @@ const field = { fieldResponse.elementColumnName = elementColumnName } else if (tableName && columnName) { fieldResponse.tableName = tableName - fieldResponse.columnName = columnName + fieldResponse.column_name = columnName } commit('addField', fieldResponse) @@ -151,7 +151,7 @@ const field = { }, getFieldFromElementColumnName: (state) => (elementColumnName) => { return state.fieldsList.find(fieldItem => { - return fieldItem.elementName === elementColumnName + return fieldItem.element_name === elementColumnName }) }, getFieldFromTableNameAndColumnName: (state) => ({ @@ -160,7 +160,7 @@ const field = { }) => { return state.fieldsList.find(fieldItem => { return fieldItem.tableName === tableName && - fieldItem.columnName === columnName + fieldItem.column_name === columnName }) }, getSizeColumn: (state, getters) => ({ containerUuid }) => { diff --git a/src/store/modules/ADempiere/panel/actions.js b/src/store/modules/ADempiere/panel/actions.js index 3f182580d5e..42eadba494c 100644 --- a/src/store/modules/ADempiere/panel/actions.js +++ b/src/store/modules/ADempiere/panel/actions.js @@ -42,15 +42,15 @@ const actions = { if (params.fieldsList) { params.fieldsList.forEach((itemField, index, listFields) => { if (itemField.is_key) { - keyColumn = itemField.columnName + keyColumn = itemField.column_name } if (itemField.is_selection_column) { - selectionColumn.push(itemField.columnName) + selectionColumn.push(itemField.column_name) } if (itemField.is_identifier) { identifierColumns.push({ name: itemField.name, - columnName: itemField.columnName, + columnName: itemField.column_name, displayColumnName: itemField.displayColumnName, identifierSequence: itemField.identifierSequence, display_type: itemField.display_type, @@ -72,7 +72,7 @@ const actions = { // parentUuid, // containerUuid, // // isOverWriteParent: Boolean(isParentTab), - // columnName: itemField.columnName, + // columnName: itemField.column_name, // value: itemField.value // }) } @@ -80,11 +80,11 @@ const actions = { if (!isEmptyValue(itemField.parentFieldsList)) { itemField.parentFieldsList.forEach(itemParentColumnName => { const parentField = listFields.find(parentFieldItem => { - return parentFieldItem.columnName === itemParentColumnName && - itemParentColumnName !== itemField.columnName + return parentFieldItem.column_name === itemParentColumnName && + itemParentColumnName !== itemField.column_name }) if (parentField) { - parentField.dependentFieldsList.push(itemField.columnName) + parentField.dependent_fields.push(itemField.column_name) } }) } @@ -158,14 +158,14 @@ const actions = { } const fieldsList = panel.fieldsList.map(itemField => { - const { columnName } = itemField + const { column_name } = itemField // not change exlude field - if (!isEmptyValue(fieldsExcludes) && fieldsExcludes.includes(columnName)) { + if (!isEmptyValue(fieldsExcludes) && fieldsExcludes.includes(column_name)) { return itemField } // if it field is included to change value - if (!isEmptyValue(fieldsIncludes) && fieldsIncludes.includes(columnName)) { + if (!isEmptyValue(fieldsIncludes) && fieldsIncludes.includes(column_name)) { itemField[attribute] = valueAttribute return itemField } @@ -193,9 +193,9 @@ const actions = { } const fieldsIncludes = [] fieldsList.forEach(fieldItem => { - const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic - if (isMandatory) { - fieldsIncludes.push(fieldItem.columnName) + const isMandatoryGenerated = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic + if (isMandatoryGenerated) { + fieldsIncludes.push(fieldItem.column_name) } }) @@ -224,7 +224,7 @@ const actions = { const fieldsIncludes = [] fieldsList.forEach(fieldItem => { if (fieldIsDisplayed(fieldItem, true)) { - fieldsIncludes.push(fieldItem.columnName) + fieldsIncludes.push(fieldItem.column_name) } }) @@ -310,7 +310,7 @@ const actions = { // }) // } // // if (itemField.isShowedFromUserDefault || !isEmptyValue(itemField.value)) { - // // fieldsUser.push(itemField.columnName) + // // fieldsUser.push(itemField.column_name) // // } // } // panel.fieldsList.forEach(execute) @@ -363,7 +363,7 @@ const actions = { let fieldsList = [] if (isEmptyValue(field)) { fieldsList = getters.getFieldsListFromPanel(containerUuid) - field = fieldsList.find(fieldItem => fieldItem.columnName === columnName) + field = fieldsList.find(fieldItem => fieldItem.column_name === columnName) } if (containerManager.getFieldsList && !isEmptyValue(field.parentUuid)) { fieldsList = containerManager.getFieldsList({ @@ -373,7 +373,7 @@ const actions = { } if (isEmptyValue(field)) { - field = fieldsList.find(fieldItem => fieldItem.columnName === columnName) + field = fieldsList.find(fieldItem => fieldItem.column_name === columnName) if (isEmptyValue(field)) { console.warn('notifyFieldChange: Field not found ', columnName) return @@ -385,7 +385,7 @@ const actions = { value = getters.getValueOfField({ parentUuid: field.parentUuid, containerUuid: field.containerUuid, - columnName: field.columnName + columnName: field.column_name }) } else { value = newValue @@ -413,7 +413,7 @@ const actions = { if (response) { dispatch('notifyPanelChange', { containerUuid: field.containerUuid, - columnName: field.columnName, + columnName: field.column_name, attributes: response.attributes }) } @@ -446,13 +446,12 @@ const actions = { isGetDefaultValue = true, containerManager }) { - if (isEmptyValue(field.dependentFieldsList)) { + const { parentUuid, dependent_fields } = field + if (isEmptyValue(dependent_fields)) { // breaks if there are no field dependencies return } - const { parentUuid } = field - // Get all fields if (isEmptyValue(fieldsList)) { if (containerManager && containerManager.getFieldsList) { @@ -467,12 +466,8 @@ const actions = { } } - if (isEmptyValue(field.dependentFieldsList)) { - return - } - // Iterate for change logic - field.dependentFieldsList.map(async fieldDependentDefinition => { + dependent_fields.map(async fieldDependentDefinition => { let containerName, containerUuid, columnName let fieldId = -1 // old implementation (used on forms) @@ -482,9 +477,9 @@ const actions = { } else { // new implementation fieldId = fieldDependentDefinition.id - columnName = fieldDependentDefinition.columnName - containerUuid = fieldDependentDefinition.containerUuid - containerName = fieldDependentDefinition.containerName + columnName = fieldDependentDefinition.column_name + containerUuid = fieldDependentDefinition.container_uuid + containerName = fieldDependentDefinition.container_name } // Get all fields on different container @@ -499,7 +494,7 @@ const actions = { if (isEmptyValue(currentFieldsList)) { console.warn('fieldsList not found in vuex store', { parentUuid, - parent_column_name: field.columnName, + parent_column_name: field.column_name, parentContainerName: field.panelName, parentContainerUuid: field.containerUuid, dependentColumnName: columnName, @@ -513,14 +508,14 @@ const actions = { if (!isEmptyValue(fieldId)) { return fieldId === fieldItem.id } - return columnName === fieldItem.columnName || - columnName === fieldItem.elementName + return columnName === fieldItem.column_name || + columnName === fieldItem.element_name }) if (isEmptyValue(storedFieldDependentsList)) { console.warn('field not found in vuex store', { parentUuid, - parent_column_name: field.columnName, + parent_column_name: field.column_name, parentContainerName: field.panelName, parentContainerUuid: field.containerUuid, dependentColumnName: columnName, @@ -536,7 +531,7 @@ const actions = { storedFieldDependentsList.map(i => { return { id: i.id, - columnName: i.columnName, + columnName: i.column_name, name: i.name } }) @@ -548,12 +543,12 @@ const actions = { // isDisplayed Logic let isDisplayedFromLogic, isMandatoryFromLogic, isReadOnlyFromLogic - if (!isEmptyValue(storedFieldDependent.displayLogic)) { + if (!isEmptyValue(storedFieldDependent.display_logic)) { isDisplayedFromLogic = evaluator.evaluateLogic({ context: getContext, parentUuid, containerUuid, - logic: storedFieldDependent.displayLogic + logic: storedFieldDependent.display_logic }) } // Mandatory Logic @@ -602,7 +597,7 @@ const actions = { containerManager }) { return new Promise(resolve => { - const { columnName } = field + const { column_name } = field const resolveValues = { value: undefined, defaultValue: undefined, @@ -644,7 +639,7 @@ const actions = { newValue = rootGetters.getValueOfField({ parentUuid, containerUuid, - columnName: columnName + columnName: column_name }) if (!isEmptyValue(newValue)) { displayedValue = rootGetters.getValueOfField({ @@ -661,7 +656,7 @@ const actions = { contextColumnNames: field.contextColumnNames, uuid: field.uuid, id: field.id, - columnName: columnName, + columnName: column_name, defaultValue: field.default_value }) @@ -673,7 +668,7 @@ const actions = { commit('updateValueOfField', { parentUuid, containerUuid, - columnName: columnName, + columnName: column_name, value: newValue }) // update values for field on elememnt name of column @@ -681,7 +676,7 @@ const actions = { commit('updateValueOfField', { parentUuid, containerUuid, - columnName: field.elementName, + columnName: field.element_name, value: newValue }) } diff --git a/src/utils/ADempiere/contextUtils/contextField.js b/src/utils/ADempiere/contextUtils/contextField.js index 1e6bd3e8192..ee3a534ac36 100644 --- a/src/utils/ADempiere/contextUtils/contextField.js +++ b/src/utils/ADempiere/contextUtils/contextField.js @@ -30,16 +30,17 @@ import { isNumberField, isIdentifierField } from '@/utils/ADempiere/references' /** * Extracts the associated fields from the logics or default values - * @param {string} displayLogic + * @param {string} display_logic * @param {string} mandatory_logic * @param {string} read_only_logic - * @param {object} reference.contextColumnNames array + * @param {object} reference.context_column_names array * @param {string} default_value * @param {string} default_value_to + * @param {array} context_column_names array * @returns {array} List column name of parent fields */ export function getParentFields({ - displayLogic, + display_logic, mandatory_logic, read_only_logic, reference, @@ -59,7 +60,7 @@ export function getParentFields({ // For Validation Code ...contextColumnNamesByReference, // For Display logic - ...evaluator.parseDepends(displayLogic), + ...evaluator.parseDepends(display_logic), // For Mandatory Logic ...evaluator.parseDepends(mandatory_logic), // For Read Only Logic @@ -83,7 +84,7 @@ export function getParentFields({ export function getEvaluatedFieldLogics({ parentUuid, containerUuid, - displayLogic, + display_logic, mandatory_logic, read_only_logic }) { @@ -94,11 +95,11 @@ export function getEvaluatedFieldLogics({ context: getContext } - let isDisplayedFromLogic = isEmptyValue(displayLogic) + let isDisplayedFromLogic = isEmptyValue(display_logic) if (!isDisplayedFromLogic) { isDisplayedFromLogic = evaluator.evaluateLogic({ ...commonParameters, - logic: displayLogic + logic: display_logic }) } @@ -134,12 +135,12 @@ export function getContextDefaultValue({ parentUuid, containerUuid, isSOTrxDictionary, - columnName, - elementName, + column_name, + element_name, componentPath, display_type, default_value, - isMandatory, + is_mandatory, isColumnReadOnlyForm, is_key }) { @@ -152,19 +153,19 @@ export function getContextDefaultValue({ parsedDefaultValue = parseContext({ parentUuid, containerUuid, - columnName, + columnName: column_name, value: parsedDefaultValue, isSOTrxDictionary }).value } - const isSpeciaColumn = !isEmptyValue(arrayMatches(ACCOUNTING_COLUMNS, [columnName, elementName])) + const isSpeciaColumn = !isEmptyValue(arrayMatches(ACCOUNTING_COLUMNS, [column_name, element_name])) // search value with context if (isSpeciaColumn && String(parsedDefaultValue).trim() !== '-1') { parsedDefaultValue = getPreference({ parentUuid, containerUuid, - columnName + columnName: column_name }) } @@ -174,16 +175,16 @@ export function getContextDefaultValue({ parsedDefaultValue = getPreference({ parentUuid, containerUuid, - columnName + columnName: column_name }) // search value preference with element name - if (!isEmptyValue(elementName) && + if (!isEmptyValue(element_name) && isEmptyValue(parsedDefaultValue)) { parsedDefaultValue = getPreference({ parentUuid, containerUuid, - columnName: elementName + columnName: element_name }) } } @@ -191,7 +192,7 @@ export function getContextDefaultValue({ // search value with form read only if (isColumnReadOnlyForm && isEmptyValue(parsedDefaultValue)) { const { defaultValue: defaultValueColumn } = READ_ONLY_FORM_COLUMNS.find(columnItem => { - return columnItem.columnName === columnName + return columnItem.columnName === column_name }) parsedDefaultValue = defaultValueColumn } @@ -203,7 +204,7 @@ export function getContextDefaultValue({ } if (isEmptyValue(parsedDefaultValue)) { if (isNumberField(display_type)) { - if (isMandatory) { + if (is_mandatory) { parsedDefaultValue = 0 } } else if (isIdentifierField(display_type)) { @@ -214,10 +215,10 @@ export function getContextDefaultValue({ // convert to element-ui compatible value parsedDefaultValue = parsedValueComponent({ - columnName, + columnName: column_name, componentPath, displayType: display_type, - isMandatory, + isMandatory: is_mandatory, value: parsedDefaultValue }) diff --git a/src/utils/ADempiere/dictionary/browser.js b/src/utils/ADempiere/dictionary/browser.js index e0bdeb4b2b2..7177bf6b93a 100644 --- a/src/utils/ADempiere/dictionary/browser.js +++ b/src/utils/ADempiere/dictionary/browser.js @@ -39,13 +39,13 @@ import { convertStringToBoolean } from '@/utils/ADempiere/formatValue/booleanFor /** * Is displayed field in panel query criteria */ -export function isDisplayedField({ display_type, is_query_criteria, displayLogic, isDisplayedFromLogic }) { +export function isDisplayedField({ display_type, is_query_criteria, display_logic, isDisplayedFromLogic }) { // button field not showed if (isHiddenField(display_type)) { return false } - return is_query_criteria && (isEmptyValue(displayLogic) || isDisplayedFromLogic) + return is_query_criteria && (isEmptyValue(display_logic) || isDisplayedFromLogic) } /** @@ -54,13 +54,13 @@ export function isDisplayedField({ display_type, is_query_criteria, displayLogic export function evaluateDefaultFieldShowed({ display_type, is_query_criteria, isShowedFromUser, is_displayed_as_panel, - default_value, parsedDefaultValue, displayLogic, + default_value, parsedDefaultValue, display_logic, isMandatory, isMandatoryFromLogic, mandatory_logic }) { if (!isEmptyValue(is_displayed_as_panel)) { return convertStringToBoolean(is_displayed_as_panel) } - if (!isEmptyValue(displayLogic)) { + if (!isEmptyValue(display_logic)) { return true } const isMandatoryGenerated = isMandatoryField({ @@ -501,13 +501,13 @@ export const containerManager = { if (!field.isSameColumnElement) { store.commit('updateValueOfField', { containerUuid, - columnName: field.elementName, + columnName: field.element_name, value: response.value }) store.commit('updateValueOfField', { containerUuid, - columnName: DISPLAY_COLUMN_PREFIX + field.elementName, + columnName: DISPLAY_COLUMN_PREFIX + field.element_name, value: response.displayedValue }) } diff --git a/src/utils/ADempiere/dictionary/form/index.js b/src/utils/ADempiere/dictionary/form/index.js index 896f2a7ad6b..48afc84d971 100644 --- a/src/utils/ADempiere/dictionary/form/index.js +++ b/src/utils/ADempiere/dictionary/form/index.js @@ -50,21 +50,21 @@ export function changeFieldShowedFromUser({ containerUuid, fieldsShowed = [] }) * Is displayed field * @param {number} display_type * @param {boolean} is_displayed - * @param {string} displayLogic + * @param {string} display_logic * @param {boolean} isDisplayedFromLogic * @returns {boolean} */ -export function isDisplayedField({ display_type, is_displayed, displayLogic, isDisplayedFromLogic }) { +export function isDisplayedField({ display_type, is_displayed, display_logic, isDisplayedFromLogic }) { // fields not showed if (isHiddenField(display_type)) { return false } // verify if field is active and displayed - return is_displayed && (isEmptyValue(displayLogic) || isDisplayedFromLogic) + return is_displayed && (isEmptyValue(display_logic) || isDisplayedFromLogic) } -export function isDisplayedDefault({ isMandatory }) { +export function isDisplayedDefault({ is_mandatory }) { return true } diff --git a/src/utils/ADempiere/dictionary/panel.js b/src/utils/ADempiere/dictionary/panel.js index b6c3b65a1b9..faded083a0f 100644 --- a/src/utils/ADempiere/dictionary/panel.js +++ b/src/utils/ADempiere/dictionary/panel.js @@ -167,15 +167,15 @@ export function generatePanelAndFields({ fieldsListIndex: index } }) - const { columnName, componentPath } = fieldDefinition + const { column_name, componentPath } = fieldDefinition if (fieldDefinition.is_key) { - keyColumn = columnName + keyColumn = column_name } if (fieldDefinition.is_identifier) { identifierColumns.push({ name: fieldDefinition.name, - columnName, + columnName: column_name, displayColumnName: fieldDefinition.displayColumnName, identifierSequence: fieldDefinition.identifierSequence, display_type: fieldDefinition.display_type, @@ -218,14 +218,14 @@ export function generatePanelAndFields({ return fieldItem.is_parent }) if (fieldLinkColumnName) { - fieldLinkColumnName = fieldLinkColumnName.columnName + fieldLinkColumnName = fieldLinkColumnName.column_name } } if (isAddFieldUuid) { // indicates it contains the uuid field const isWithUuidField = fieldsList.some(fieldItem => { - return fieldItem.columnName === 'UUID' + return fieldItem.column_name === 'UUID' }) // add field uuid column name if (!isWithUuidField) { @@ -284,8 +284,8 @@ export function generateDependenFieldsList(fieldsList) { itemField.parentFieldsList.forEach(itemParentColumnName => { const parentField = listFields.find(parentFieldItem => { - return (itemParentColumnName === parentFieldItem.columnName || - itemParentColumnName === parentFieldItem.elementName) + return (itemParentColumnName === parentFieldItem.column_name || + itemParentColumnName === parentFieldItem.element_name) }) if (isEmptyValue(parentField)) { @@ -293,10 +293,10 @@ export function generateDependenFieldsList(fieldsList) { } // set and remove duplicates columnNames - parentField.dependentFieldsList = [ + parentField.dependent_fields = [ ...new Set([ - itemField.columnName, - ...parentField.dependentFieldsList + itemField.column_name, + ...parentField.dependent_fields ]) ] }) diff --git a/src/utils/ADempiere/dictionary/process.js b/src/utils/ADempiere/dictionary/process.js index aefbfea9a8b..20858c9c8b3 100644 --- a/src/utils/ADempiere/dictionary/process.js +++ b/src/utils/ADempiere/dictionary/process.js @@ -38,7 +38,7 @@ export const CONTAINER_PROCESS_PREFIX = 'process_' * @param {number} display_type * @param {boolean} isActive * @param {boolean} is_displayed - * @param {string} displayLogic + * @param {string} display_logic * @param {boolean} isDisplayedFromLogic * @returns {boolean} */ diff --git a/src/utils/ADempiere/dictionary/window/index.js b/src/utils/ADempiere/dictionary/window/index.js index e925d104147..28c61ecfb5b 100644 --- a/src/utils/ADempiere/dictionary/window/index.js +++ b/src/utils/ADempiere/dictionary/window/index.js @@ -174,19 +174,19 @@ export function isDisplayedField({ is_displayed, display_logic, isDisplayedFromL /** * Default showed field from user - * @param {string} columnName + * @param {string} column_name * @param {string} default_value - * @param {boolean} isMandatory + * @param {boolean} is_mandatory * @param {boolean} isShowedFromUser * @param {boolean} is_parent */ export function evaluateDefaultFieldShowed({ parentUuid, containerUuid, - is_key, is_parent, columnName, + is_key, is_parent, column_name, default_value, parsedDefaultValue, isShowedFromUser, is_displayed_as_panel, - display_type, displayLogic, - isMandatory, mandatory_logic, isMandatoryFromLogic + display_type, display_logic, + is_mandatory, mandatory_logic, isMandatoryFromLogic }) { if (!isEmptyValue(is_displayed_as_panel)) { return convertStringToBoolean(is_displayed_as_panel) @@ -194,7 +194,7 @@ export function evaluateDefaultFieldShowed({ if (String(default_value).startsWith('@SQL=')) { return true } - if (!isEmptyValue(displayLogic)) { + if (!isEmptyValue(display_logic)) { return true } @@ -202,13 +202,13 @@ export function evaluateDefaultFieldShowed({ return true } - const { isParentTab, link_column_name, itemParentColumnName } = store.getters.getStoredTab(parentUuid, containerUuid) - if (!isParentTab && (link_column_name === columnName || itemParentColumnName === columnName)) { + const { isParentTab, link_column_name, parent_column_name } = store.getters.getStoredTab(parentUuid, containerUuid) + if (!isParentTab && (link_column_name === column_name || parent_column_name === column_name)) { return true } const isMandatoryGenerated = isMandatoryField({ - is_key, columnName, display_type, isMandatory, mandatory_logic, isMandatoryFromLogic + is_key, column_name, display_type, is_mandatory, mandatory_logic, isMandatoryFromLogic }) const isEmpty = isEmptyValue(parsedDefaultValue) || (isDecimalField(display_type) && parsedDefaultValue === 0) if (isEmpty && isMandatoryGenerated && !is_parent) { @@ -218,19 +218,19 @@ export function evaluateDefaultFieldShowed({ if (parentUuid === 'a520de12-fb40-11e8-a479-7a0060f0aa01') { // Customer Tab if (containerUuid === 'a49fb436-fb40-11e8-a479-7a0060f0aa01') { - if (['IsCustomer'].includes(columnName)) { + if (['IsCustomer'].includes(column_name)) { return true } } // Vendor Tab if (containerUuid === 'a49fb4e0-fb40-11e8-a479-7a0060f0aa01') { - if (['IsVendor'].includes(columnName)) { + if (['IsVendor'].includes(column_name)) { return true } } // Emproyee Tab if (containerUuid === 'a4a07ccc-fb40-11e8-a479-7a0060f0aa01') { - if (['IsEmployee'].includes(columnName)) { + if (['IsEmployee'].includes(column_name)) { return true } } @@ -254,7 +254,7 @@ export function evaluateDefaultFieldShowed({ // TODO: Remove this columns with fixes default value 'UserLevel' ] - if (permissedDisplayedDefault.includes(columnName)) { + if (permissedDisplayedDefault.includes(column_name)) { return true } @@ -263,18 +263,18 @@ export function evaluateDefaultFieldShowed({ /** * Default showed field from user - * @param {string} columnName + * @param {string} column_name * @param {string} default_value - * @param {boolean} isMandatory + * @param {boolean} is_mandatory * @param {boolean} isShowedTableFromUser * @param {boolean} is_parent */ export function evaluateDefaultColumnShowed({ parentUuid, containerUuid, - is_key, is_parent, columnName, + is_key, is_parent, column_name, default_value, parsedDefaultValue, display_type, isShowedTableFromUser, is_displayed_as_table, - isMandatory, mandatory_logic, isMandatoryFromLogic + is_mandatory, mandatory_logic, isMandatoryFromLogic }) { if (!isEmptyValue(is_displayed_as_table)) { return convertStringToBoolean(is_displayed_as_table) @@ -288,12 +288,12 @@ export function evaluateDefaultColumnShowed({ } const { isParentTab, link_column_name, parent_column_name } = store.getters.getStoredTab(parentUuid, containerUuid) - if (!isParentTab && (link_column_name === columnName || parent_column_name === columnName)) { + if (!isParentTab && (link_column_name === column_name || parent_column_name === column_name)) { return true } const isMandatoryGenerated = isMandatoryColumn({ - is_key, columnName, display_type, isMandatory, mandatory_logic, isMandatoryFromLogic + is_key, column_name, display_type, is_mandatory, mandatory_logic, isMandatoryFromLogic }) const isEmpty = isEmptyValue(parsedDefaultValue) || (isDecimalField(display_type) && parsedDefaultValue === 0) if (isEmpty && isMandatoryGenerated && !is_parent) { @@ -317,7 +317,7 @@ export function evaluateDefaultColumnShowed({ 'TaskStatus' ] - if (permissedDisplayedDefault.includes(columnName)) { + if (permissedDisplayedDefault.includes(column_name)) { return true } @@ -328,13 +328,13 @@ export function evaluateDefaultColumnShowed({ * Tab manager mandatory logic * @see https://github.com/adempiere/adempiere/blob/develop/base/src/org/compiere/model/GridField.java#L401 * @param {boolean} is_key - * @param {string} columnName - * @param {boolean} isMandatory + * @param {string} column_name + * @param {boolean} is_mandatory * @param {string} mandatory_logic * @param {boolean} isMandatoryFromLogic * @returns {boolean} */ -export function isMandatoryField({ is_key, columnName, display_type, isMandatory, mandatory_logic, isMandatoryFromLogic }) { +export function isMandatoryField({ is_key, column_name, display_type, is_mandatory, mandatory_logic, isMandatoryFromLogic }) { if (display_type === BUTTON.id) { return false } @@ -354,19 +354,19 @@ export function isMandatoryField({ is_key, columnName, display_type, isMandatory VALUE, DOCUMENT_NO, 'M_AttributeSetInstance_ID' ] if ( - (is_key && columnName.endsWith(IDENTIFIER_COLUMN_SUFFIX)) || - columnName.startsWith('Created') || columnName.startsWith('Updated') || - notMandatoryRender.includes(columnName) + (is_key && column_name.endsWith(IDENTIFIER_COLUMN_SUFFIX)) || + column_name.startsWith('Created') || column_name.startsWith('Updated') || + notMandatoryRender.includes(column_name) ) { return false } // is mandatory - if (isMandatory) { + if (is_mandatory) { // TODO: Evaluate displayed return true } - // return isMandatory || (!isEmptyValue(mandatory_logic) && isMandatoryFromLogic) + // return is_mandatory || (!isEmptyValue(mandatory_logic) && isMandatoryFromLogic) return false } @@ -394,14 +394,14 @@ export function isDisplayedColumn({ is_displayed, is_displayed_grid, isDisplayed (isEmptyValue(display_logic) || isDisplayedFromLogic) } -export function isMandatoryColumn({ is_key, columnName, display_type, is_mandatory, mandatory_logic, isMandatoryFromLogic }) { +export function isMandatoryColumn({ is_key, column_name, display_type, is_mandatory, mandatory_logic, isMandatoryFromLogic }) { const notMandatoryRender = [ VALUE, DOCUMENT_NO, 'M_AttributeSetInstance_ID' ] if ( - (is_key && columnName.endsWith(IDENTIFIER_COLUMN_SUFFIX)) || - columnName.startsWith('Created') || columnName.startsWith('Updated') || - notMandatoryRender.includes(columnName) + (is_key && column_name.endsWith(IDENTIFIER_COLUMN_SUFFIX)) || + column_name.startsWith('Created') || column_name.startsWith('Updated') || + notMandatoryRender.includes(column_name) ) { return false } @@ -899,7 +899,8 @@ export const openBrowserAssociated = { containerUuid: browserUuid }) const tabContext = store.getters.getValuesView({ - containerUuid + containerUuid, + format: 'object' }) store.dispatch('updateValuesOfContainer', { @@ -907,21 +908,21 @@ export const openBrowserAssociated = { attributes: tabContext }) + // load the tab fields storedBrowser.fieldsList.forEach(itemField => { - if (!itemField.isSameColumnElement) { - const currentValueElement = tabContext.find(itemAttribute => { - return itemAttribute.columnName === itemField.elementName - }) - if (!isEmptyValue(currentValueElement) && !isEmptyValue(currentValueElement.value)) { + const { isSameColumnElement, column_name, element_name } = itemField + if (!isSameColumnElement) { + const currentContextValue = tabContext[element_name] + if (!isEmptyValue(currentContextValue)) { store.commit('updateValueOfField', { containerUuid: browserUuid, - columnName: itemField.elementName, - value: currentValueElement.value + columnName: element_name, + value: currentContextValue }) store.commit('updateValueOfField', { containerUuid: browserUuid, - columnName: itemField.columnName, - value: currentValueElement.value + columnName: column_name, + value: currentContextValue }) } // change Dependents @@ -932,6 +933,7 @@ export const openBrowserAssociated = { } }) + // clear resutls store.dispatch('clearBrowserData', { containerUuid: browserUuid }) @@ -939,20 +941,24 @@ export const openBrowserAssociated = { // set record id from window const storedTab = store.getters.getStoredTab(parentUuid, containerUuid) - const { keyColumn } = storedTab + const { keyColumn, table, parent_column_name, link_column_name } = storedTab + const { key_columns } = table - let relatedColumns = [] + let relatedColumns = key_columns // TODO: Validate element columns const parentColumns = storedTab.fieldsList .filter(fieldItem => { - return fieldItem.is_parent || fieldItem.is_key || fieldItem.isMandatory + return fieldItem.is_parent || fieldItem.is_key || fieldItem.is_mandatory }) .map(fieldItem => { - return fieldItem.columnName + return fieldItem.column_name }) - if (!isEmptyValue(storedTab.parentColumn)) { - relatedColumns = relatedColumns.push(storedTab.parentColumn) + if (!isEmptyValue(parent_column_name)) { + relatedColumns.push(parent_column_name) + } + if (!isEmptyValue(link_column_name)) { + relatedColumns.push(link_column_name) } relatedColumns = relatedColumns.concat(parentColumns).sort() @@ -1713,8 +1719,8 @@ export const containerManager = { }, isDisplayedField, - isDisplayedDefault: ({ isMandatory, is_parent, default_value, display_type, parsedDefaultValue }) => { - if (isMandatory && !is_parent && isEmptyValue(default_value)) { + isDisplayedDefault: ({ is_mandatory, is_parent, default_value, display_type, parsedDefaultValue }) => { + if (is_mandatory && !is_parent && isEmptyValue(default_value)) { // Yes/No field always boolean value (as default value) if (display_type === YES_NO.id) { return false @@ -1724,8 +1730,8 @@ export const containerManager = { return false }, isDisplayedColumn, - isDisplayedDefaultTable: ({ isMandatory, is_parent, default_value, display_type, parsedDefaultValue }) => { - if (isMandatory && !is_parent && isEmptyValue(default_value)) { + isDisplayedDefaultTable: ({ is_mandatory, is_parent, default_value, display_type, parsedDefaultValue }) => { + if (is_mandatory && !is_parent && isEmptyValue(default_value)) { // Yes/No field always boolean value (as default value) if (display_type === YES_NO.id) { return false diff --git a/src/utils/ADempiere/dictionaryUtils.js b/src/utils/ADempiere/dictionaryUtils.js index dce45e23198..b27836d45e5 100644 --- a/src/utils/ADempiere/dictionaryUtils.js +++ b/src/utils/ADempiere/dictionaryUtils.js @@ -96,7 +96,7 @@ export function generateField({ }, isSOTrxDictionary }) { - const { columnName } = fieldToGenerate + const { column_name: columnName } = fieldToGenerate let isGetServerValue = false let isColumnReadOnlyForm = false let isChangedAllForm = false @@ -170,8 +170,8 @@ export function generateField({ containerUuid: moreAttributes.containerUuid, componentPath: componentReference.componentPath, default_value: fieldToGenerate.default_value_to, - columnName: `${columnName}_To`, - elementName: `${fieldToGenerate.elementName}_To`, + column_name: `${columnName}_To`, + element_name: `${fieldToGenerate.element_name}_To`, isSOTrxDictionary }) @@ -185,7 +185,7 @@ export function generateField({ // manage document status and tag document status isColumnDocumentStatus = isDocumentStatus({ columnName, - elementColumnName: fieldToGenerate.elementColumnName + elementColumnName: fieldToGenerate.element_name }) } // set field operators list @@ -216,8 +216,8 @@ export function generateField({ fieldToGenerate.name ), columnNameTo: `${columnName}_To`, - elementNameTo: `${fieldToGenerate.elementColumnName}_To`, - isSameColumnElement: columnName === fieldToGenerate.elementColumnName, + elementNameTo: `${fieldToGenerate.element_name}_To`, + isSameColumnElement: columnName === fieldToGenerate.element_name, isSOTrxDictionary, // displayed attributes componentPath: componentReference.componentPath, @@ -235,7 +235,7 @@ export function generateField({ ...evaluatedLogics, // parentFieldsList, - // dependentFieldsList: [], + // dependent_fields: [], // TODO: Add support on server // app attributes isShowedFromUser: false, @@ -269,7 +269,9 @@ export function generateField({ field.operator = OPERATOR_LESS_EQUAL.operator field.uuid = `${field.uuid}_To` field.columnName = field.columnNameTo + field.column_name = field.columnNameTo field.elementName = field.elementNameTo + field.element_name = field.elementNameTo field.name = `${field.name} To` field.value = parsedDefaultValueTo field.default_value = field.default_value_to diff --git a/src/utils/ADempiere/lookupFactory.js b/src/utils/ADempiere/lookupFactory.js index 774189665b8..b6f2e6e9325 100644 --- a/src/utils/ADempiere/lookupFactory.js +++ b/src/utils/ADempiere/lookupFactory.js @@ -173,7 +173,7 @@ function getFactoryFromField({ }) { const definition = { parentFieldsList: field.parentFieldsList || [], - dependentFieldsList: field.dependentFieldsList || [], + dependent_fields: field.dependent_fields || [], ...field, is_displayed: true, // Overwrite definition @@ -313,7 +313,7 @@ export function getFieldTemplate(overwriteDefinition) { // browser attributes callout: undefined, is_query_criteria: false, - displayLogic: undefined, + display_logic: undefined, mandatory_logic: undefined, read_only_logic: undefined, handleFocusGained: false, @@ -322,7 +322,7 @@ export function getFieldTemplate(overwriteDefinition) { handleKeyReleased: false, handleActionKeyPerformed: false, handleActionPerformed: false, - dependentFieldsList: [], + dependent_fields: [], reference: { tableName: '', keyColumnName: '', @@ -337,7 +337,7 @@ export function getFieldTemplate(overwriteDefinition) { ...overwriteDefinition } - if (isEmptyValue(fieldTemplateMetadata.elementName) && !isEmptyValue(fieldTemplateMetadata.columnName)) { + if (isEmptyValue(fieldTemplateMetadata.element_name) && !isEmptyValue(fieldTemplateMetadata.columnName)) { fieldTemplateMetadata.elementColumnName = fieldTemplateMetadata.columnName } @@ -355,7 +355,7 @@ export function getFieldTemplate(overwriteDefinition) { ...fieldTemplateMetadata, default_value: fieldTemplateMetadata.default_value_to, columnName: `${fieldTemplateMetadata.columnName}_To`, - elementName: `${fieldTemplateMetadata.elementName}_To` + element_name: `${fieldTemplateMetadata.element_name}_To` }) } diff --git a/src/views/ADempiere/Browser/index.vue b/src/views/ADempiere/Browser/index.vue index 4f6ac409512..f69132deb79 100644 --- a/src/views/ADempiere/Browser/index.vue +++ b/src/views/ADempiere/Browser/index.vue @@ -132,10 +132,16 @@ export default defineComponent({ const browserMetadata = ref({}) const containerManagerProcess = ref({}) + // as window source let parentUuid = '' if (!isEmptyValue(root.$route.query) && !isEmptyValue(root.$route.query.parentUuid)) { parentUuid = root.$route.query.parentUuid } + // as tab source + let containerUuid = '' + if (!isEmptyValue(root.$route.query) && !isEmptyValue(root.$route.query.containerUuid)) { + containerUuid = root.$route.query.containerUuid + } let browserId = -1 // set uuid with linked menu @@ -272,7 +278,8 @@ export default defineComponent({ store.dispatch('getBrowserDefinitionFromServer', { id: browserId, - parentUuid + parentUuid, + containerUuid }) .then(browserResponse => { generateBrowser(browserResponse)