1) Make default values column read-only for inherited columns when creating table.

2) Default values not populated for inherited columns. The existing issue, API changed.
3) Options are not populated for Name in Column > Variable tab.
4) The empty check error message is changed from Label cannot be empty to Label in Collection cannot be empty for collections.

Fixes #6763
This commit is contained in:
Aditya Toshniwal
2021-09-21 16:56:29 +05:30
committed by Akshay Joshi
parent b60bd73f88
commit 08009f8edc
5 changed files with 29 additions and 7 deletions

View File

@@ -233,7 +233,7 @@ function getChangedData(topSchema, viewHelperProps, sessData, stringify=false) {
return changedData;
}
function validateSchema(schema, sessData, setError, accessPath=[]) {
function validateSchema(schema, sessData, setError, accessPath=[], collLabel=null) {
sessData = sessData || {};
for(let field of schema.fields) {
/* Skip id validation */
@@ -261,7 +261,7 @@ function validateSchema(schema, sessData, setError, accessPath=[]) {
}
/* Loop through data */
for(const [rownum, row] of rows.entries()) {
if(validateSchema(field.schema, row, setError, currPath.concat(rownum))) {
if(validateSchema(field.schema, row, setError, currPath.concat(rownum), field.label)) {
return true;
}
}
@@ -276,7 +276,14 @@ function validateSchema(schema, sessData, setError, accessPath=[]) {
let value = sessData[field.id];
let message = null;
if(field.noEmpty) {
message = emptyValidator(field.label, value);
let label = field.label;
if(collLabel) {
label = gettext('%s in %s', field.label, collLabel);
}
if(field.noEmptyLabel) {
label = field.noEmptyLabel;
}
message = emptyValidator(label, value);
}
if(!message && (field.type == 'int' || field.type == 'numeric')) {
message = minMaxValidator(field.label, value, field.min, field.max);