Skip to content

Commit

Permalink
fix: Callout context, return clear empty values. (adempiere#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Jun 6, 2023
1 parent 1c31aa6 commit 4a73e52
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/store/modules/ADempiere/calloutManager.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: {
Expand Down Expand Up @@ -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'
Expand Down
8 changes: 6 additions & 2 deletions src/store/modules/ADempiere/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -152,7 +156,7 @@ const persistence = {
}
commit('addChangeToPersistenceQueue', {
containerUuid,
recordUuid: getters.getUuidOfContainer(field.containerUuid),
recordUuid,
columnName: field.displayColumnName,
oldValue: displayedValue,
value: undefined
Expand All @@ -161,7 +165,7 @@ const persistence = {

commit('addChangeToPersistenceQueue', {
containerUuid,
recordUuid: getters.getUuidOfContainer(field.containerUuid),
recordUuid,
columnName,
oldValue,
value
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default
Submodule default updated 22 files
+4 −0 components/ADempiere/DataTable/Browser/index.vue
+8 −28 components/ADempiere/FieldDefinition/FieldLocationAddress/locationAddressForm.vue
+6 −12 components/ADempiere/FieldDefinition/FieldText.vue
+218 −101 components/ADempiere/Form/Issues/component/Comment.vue
+15 −29 components/ADempiere/Form/Issues/index.vue
+210 −56 components/ADempiere/Form/VAllocation/components/Payments.vue
+4 −4 components/ADempiere/Form/VAllocation/components/SearchCriteria.vue
+4 −2 components/ADempiere/Form/VAllocation/components/Summary.vue
+22 −21 components/ADempiere/Form/VAllocation/index.vue
+53 −14 components/ADempiere/Form/VBankStatementMatch/AutomaticMatch.vue
+89 −21 components/ADempiere/Form/VBankStatementMatch/ManualMatch.vue
+169 −226 components/ADempiere/Form/VBankStatementMatch/SearchCriteria.vue
+23 −6 components/ADempiere/Form/VBankStatementMatch/index.vue
+5 −3 components/ADempiere/Form/VMatch/components/Invoices/index.vue
+5 −3 components/ADempiere/Form/VPayPrint/index.vue
+0 −20 components/ADempiere/Form/WorkflowActivity/index.vue
+24 −5 components/ADempiere/PanelInfo/Component/RecordDashboard/component/Parameters.vue
+17 −8 components/ADempiere/PanelInfo/Component/RecordDashboard/component/chart.vue
+17 −18 components/ADempiere/PanelInfo/Component/RecordDashboard/index.vue
+13 −4 components/ADempiere/PanelInfo/Component/RecordIssues/component/Comment.vue
+8 −4 components/ADempiere/PanelInfo/Component/RecordIssues/index.vue
+1 −1 components/ADempiere/TabManager/tabChild.vue
32 changes: 31 additions & 1 deletion src/utils/ADempiere/references.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4a73e52

Please sign in to comment.