Bugfix create order lines (#311)
* Bugfix create order lines * bugfix context boolean value * validate void label for create entity * rename variablespull/3759/head
parent
7f74235073
commit
d55e7b7d4d
|
@ -195,6 +195,9 @@ const data = {
|
||||||
// overwrite value with column link
|
// overwrite value with column link
|
||||||
if (!isEmptyValue(linkColumnName) && linkColumnName === itemField.columnName) {
|
if (!isEmptyValue(linkColumnName) && linkColumnName === itemField.columnName) {
|
||||||
valueGetDisplayColumn = valueLink
|
valueGetDisplayColumn = valueLink
|
||||||
|
if (isEmptyValue(values[itemField.columnName])) {
|
||||||
|
values[itemField.columnName] = valueGetDisplayColumn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// break this itineration if is empty
|
// break this itineration if is empty
|
||||||
|
@ -209,7 +212,7 @@ const data = {
|
||||||
valueGetDisplayColumn = parseInt(valueGetDisplayColumn, 10)
|
valueGetDisplayColumn = parseInt(valueGetDisplayColumn, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isEmptyValue(valueGetDisplayColumn) && String(valueGetDisplayColumn) === '[object Object]') {
|
if (!isEmptyValue(valueGetDisplayColumn) && String(valueGetDisplayColumn) === '[object Object]' && valueGetDisplayColumn.isSQL) {
|
||||||
// get value from direct Query
|
// get value from direct Query
|
||||||
dispatch('getRecordBySQL', {
|
dispatch('getRecordBySQL', {
|
||||||
query: valueGetDisplayColumn.query,
|
query: valueGetDisplayColumn.query,
|
||||||
|
@ -226,7 +229,7 @@ const data = {
|
||||||
containerUuid,
|
containerUuid,
|
||||||
isNew,
|
isNew,
|
||||||
isEdit,
|
isEdit,
|
||||||
values
|
row: values
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -246,6 +249,9 @@ const data = {
|
||||||
// if there is a lookup option, assign the display column with the label
|
// if there is a lookup option, assign the display column with the label
|
||||||
if (option) {
|
if (option) {
|
||||||
values[`DisplayColumn_${itemField.columnName}`] = option.label
|
values[`DisplayColumn_${itemField.columnName}`] = option.label
|
||||||
|
if (isEmptyValue(option.label) && !itemField.isMandatory) {
|
||||||
|
values[itemField.columnName] = undefined
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (linkColumnName === itemField.columnName) {
|
if (linkColumnName === itemField.columnName) {
|
||||||
|
@ -629,8 +635,8 @@ const data = {
|
||||||
notifyRowTableChange({ commit, getters, rootGetters }, objectParams) {
|
notifyRowTableChange({ commit, getters, rootGetters }, objectParams) {
|
||||||
const { parentUuid, containerUuid, isEdit = true } = objectParams
|
const { parentUuid, containerUuid, isEdit = true } = objectParams
|
||||||
var currentValues = {}
|
var currentValues = {}
|
||||||
if (objectParams.hasOwnProperty('values')) {
|
if (objectParams.hasOwnProperty('row')) {
|
||||||
currentValues = objectParams.values
|
currentValues = objectParams.row
|
||||||
} else {
|
} else {
|
||||||
currentValues = rootGetters.getColumnNamesAndValues({
|
currentValues = rootGetters.getColumnNamesAndValues({
|
||||||
parentUuid,
|
parentUuid,
|
||||||
|
|
|
@ -1073,14 +1073,14 @@ const panel = {
|
||||||
columnName: fieldItem.columnName,
|
columnName: fieldItem.columnName,
|
||||||
value: fieldItem.defaultValue,
|
value: fieldItem.defaultValue,
|
||||||
isSQL
|
isSQL
|
||||||
}).value
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
valueToReturn = parsedValueComponent({
|
valueToReturn = parsedValueComponent({
|
||||||
fieldType: fieldItem.componentPath,
|
fieldType: fieldItem.componentPath,
|
||||||
referenceType: fieldItem.referenceType,
|
referenceType: fieldItem.referenceType,
|
||||||
isMandatory: fieldItem.isMandatory,
|
isMandatory: fieldItem.isMandatory,
|
||||||
value: valueToReturn
|
value: String(valueToReturn) === '[object Object]' && valueToReturn.isSQL ? valueToReturn : String(valueToReturn) === '[object Object]' ? valueToReturn.value : valueToReturn
|
||||||
})
|
})
|
||||||
attributesObject[fieldItem.columnName] = valueToReturn
|
attributesObject[fieldItem.columnName] = valueToReturn
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ export function parseContext({
|
||||||
isSQL = false,
|
isSQL = false,
|
||||||
isBooleanToString = false
|
isBooleanToString = false
|
||||||
}) {
|
}) {
|
||||||
// const isBooleanToString = value.includes('@SQL=')
|
|
||||||
let isError = false
|
let isError = false
|
||||||
const errorsList = []
|
const errorsList = []
|
||||||
value = String(value)
|
value = String(value)
|
||||||
|
@ -94,74 +93,78 @@ export function parseContext({
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var token
|
var token
|
||||||
var inStr = value
|
var inString = value
|
||||||
var outStr = ''
|
var outString = ''
|
||||||
|
|
||||||
let firstIndexTag = inStr.indexOf('@')
|
let firstIndexTag = inString.indexOf('@')
|
||||||
|
|
||||||
while (firstIndexTag !== -1) {
|
while (firstIndexTag !== -1) {
|
||||||
outStr = outStr + inStr.substring(0, firstIndexTag) // up to @
|
outString = outString + inString.substring(0, firstIndexTag) // up to @
|
||||||
inStr = inStr.substring(firstIndexTag + 1, inStr.length) // from first @
|
inString = inString.substring(firstIndexTag + 1, inString.length) // from first @
|
||||||
const secondIndexTag = inStr.indexOf('@') // next @
|
const secondIndexTag = inString.indexOf('@') // next @
|
||||||
// no exists second tag
|
// no exists second tag
|
||||||
if (secondIndexTag < 0) {
|
if (secondIndexTag < 0) {
|
||||||
console.info(`No second tag: ${inStr}`)
|
console.info(`No second tag: ${inString}`)
|
||||||
return {
|
return {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
isError: true,
|
isError: true,
|
||||||
errorsList
|
errorsList,
|
||||||
|
isSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
token = inStr.substring(0, secondIndexTag)
|
token = inString.substring(0, secondIndexTag)
|
||||||
columnName = token
|
columnName = token
|
||||||
|
|
||||||
var ctxInfo = getContext({
|
var contextInfo = getContext({
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
columnName
|
columnName
|
||||||
}) // get context
|
}) // get context
|
||||||
if (isBooleanToString && typeof ctxInfo === 'boolean') {
|
if (isBooleanToString && typeof contextInfo === 'boolean') {
|
||||||
ctxInfo = 'N'
|
if (contextInfo) {
|
||||||
if (ctxInfo) {
|
contextInfo = 'Y'
|
||||||
ctxInfo = 'Y'
|
} else {
|
||||||
|
contextInfo = 'N'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ctxInfo === undefined || ctxInfo.length === 0) &&
|
if ((contextInfo === undefined || contextInfo.length === 0) &&
|
||||||
(token.startsWith('#') || token.startsWith('$'))) {
|
(token.startsWith('#') || token.startsWith('$'))) {
|
||||||
ctxInfo = getContext({
|
contextInfo = getContext({
|
||||||
columnName
|
columnName
|
||||||
}) // get global context
|
}) // get global context
|
||||||
}
|
}
|
||||||
if (ctxInfo === undefined || ctxInfo.length === 0) {
|
if (contextInfo === undefined || contextInfo.length === 0) {
|
||||||
console.info(`No Context for: ${token}`)
|
console.info(`No Context for: ${token}`)
|
||||||
isError = true
|
isError = true
|
||||||
errorsList.push(token)
|
errorsList.push(token)
|
||||||
} else {
|
} else {
|
||||||
if (typeof ctxInfo === 'object') {
|
if (typeof contextInfo === 'object') {
|
||||||
outStr = ctxInfo
|
outString = contextInfo
|
||||||
} else {
|
} else {
|
||||||
outStr = outStr + ctxInfo // replace context with Context
|
outString = outString + contextInfo // replace context with Context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inStr = inStr.substring(secondIndexTag + 1, inStr.length) // from second @
|
inString = inString.substring(secondIndexTag + 1, inString.length) // from second @
|
||||||
firstIndexTag = inStr.indexOf('@')
|
firstIndexTag = inString.indexOf('@')
|
||||||
}
|
}
|
||||||
if (typeof ctxInfo !== 'object') {
|
if (typeof contextInfo !== 'object') {
|
||||||
outStr = outStr + inStr // add the rest of the string
|
outString = outString + inString // add the rest of the string
|
||||||
}
|
}
|
||||||
if (isSQL) {
|
if (isSQL) {
|
||||||
return {
|
return {
|
||||||
query: outStr,
|
query: outString,
|
||||||
value: ctxInfo
|
value: contextInfo,
|
||||||
|
isSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
value: outStr,
|
value: outString,
|
||||||
isError,
|
isError,
|
||||||
errorsList
|
errorsList,
|
||||||
|
isSQL
|
||||||
}
|
}
|
||||||
} // parseContext
|
} // parseContext
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue