From 4a73e5262e9a4750061db7ade2b66ad39787f5ba Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Tue, 6 Jun 2023 11:41:06 -0400 Subject: [PATCH] fix: Callout context, return clear empty values. (#1030) --- src/store/modules/ADempiere/calloutManager.js | 6 ++-- src/store/modules/ADempiere/persistence.js | 8 +++-- src/themes/default | 2 +- src/utils/ADempiere/references.js | 32 ++++++++++++++++++- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/store/modules/ADempiere/calloutManager.js b/src/store/modules/ADempiere/calloutManager.js index b5ad497bfa3..942aefe0740 100644 --- a/src/store/modules/ADempiere/calloutManager.js +++ b/src/store/modules/ADempiere/calloutManager.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 @@ -24,13 +24,13 @@ import { runCallOutRequest } from '@/api/ADempiere/window' // Constants import { ROW_ATTRIBUTES } from '@/utils/ADempiere/tableUtils' import { DISPLAY_COLUMN_PREFIX, UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX } from '@/utils/ADempiere/dictionaryUtils' -import { TABLE } from '@/utils/ADempiere/references' // Utils and Helper Methods import { isEmptyValue, isSameValues } from '@/utils/ADempiere/valueUtils' import { showMessage } from '@/utils/ADempiere/notification' import { convertObjectToKeyValue } from '@/utils/ADempiere/formatValue/iterableFormat' import { isNumber } from '@/utils/ADempiere/formatValue/numberFormat' +import { isIntegerDisplayType } from '@/utils/ADempiere/references' const calloutManager = { actions: { @@ -84,7 +84,7 @@ const calloutManager = { displayType = parentField.displayType } } - if (!isEmptyValue(displayType) && displayType === TABLE.id) { + if (!isEmptyValue(displayType) && isIntegerDisplayType(displayType)) { // AD_Language = 'en_US' and table if (!isNumber(value)) { valueType = 'STRING' diff --git a/src/store/modules/ADempiere/persistence.js b/src/store/modules/ADempiere/persistence.js index e104eb205e3..f7f3e258020 100644 --- a/src/store/modules/ADempiere/persistence.js +++ b/src/store/modules/ADempiere/persistence.js @@ -126,6 +126,10 @@ const persistence = { columnName = field.columnName } + if (isEmptyValue(recordUuid)) { + recordUuid = getters.getUuidOfContainer(field.containerUuid) + } + // TODO: Old value is not working let oldValue if (!isEmptyValue(currentRecord)) { @@ -152,7 +156,7 @@ const persistence = { } commit('addChangeToPersistenceQueue', { containerUuid, - recordUuid: getters.getUuidOfContainer(field.containerUuid), + recordUuid, columnName: field.displayColumnName, oldValue: displayedValue, value: undefined @@ -161,7 +165,7 @@ const persistence = { commit('addChangeToPersistenceQueue', { containerUuid, - recordUuid: getters.getUuidOfContainer(field.containerUuid), + recordUuid, columnName, oldValue, value diff --git a/src/themes/default b/src/themes/default index 6b7d40f3037..d8fcfcd7e09 160000 --- a/src/themes/default +++ b/src/themes/default @@ -1 +1 @@ -Subproject commit 6b7d40f3037349aef698a35661db4859f1e9be11 +Subproject commit d8fcfcd7e0937bc951741ede2046efe0fce5c99a diff --git a/src/utils/ADempiere/references.js b/src/utils/ADempiere/references.js index ff1a3431e2e..414cc920525 100644 --- a/src/utils/ADempiere/references.js +++ b/src/utils/ADempiere/references.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 @@ -357,6 +357,36 @@ export function isSupportLookup(displayType) { return SUPPORTED_LOOKUPS.includes(displayType) } +export const FIELDS_IDENTIFIER = [ + ID.id, + TABLE.id, + TABLE_DIRECT.id, + SEARCH.id, + ACCOUNT_ELEMENT.id, + LOCATION_ADDRESS.id, + LOCATOR_WAREHOUSE.id, + PRODUCT_ATTRIBUTE.id, + RESOURCE_ASSIGNMENT.id +] + +/** + * Is Identifier reference + * @param {Numner} displayType or reference to displayed + * @returns {Boolean} + */ +export function isIdentifier(displayType) { + return FIELDS_IDENTIFIER.includes(displayType) +} + +/** + * Is Integer value to save by this reference to displayed + * @param {Numner} displayType or reference to displayed + * @returns {Boolean} + */ +export function isIntegerDisplayType(displayType) { + return FIELDS_IDENTIFIER.includes(displayType) || displayType === INTEGER.id +} + /** * All references * {number} id: Identifiert to field reference