Skip to content
Snippets Groups Projects
Commit 7014185c authored by François Grand's avatar François Grand
Browse files

fix: default values for selects not read from configuration file

refs #592
parent 63d385ca
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!199Resolve "Incohérence dans les fichiers de session"
Pipeline #140145 passed
......@@ -117,6 +117,27 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
return this._props;
}
public parseConfigToProps(): Props {
const res: Props = new Props();
const jp = new ConfigParser(this._jsonConfig);
for (const fs of jp.forAll("fieldset")) {
const fsp = new ConfigParser(fs["fields"]);
for (const sel of fsp.forAll("select")) {
const p = sel["property"];
if (p !== undefined) { // if select has associated property
const v = sel["default"];
if (v !== undefined) { // if select has a default value for associated property
const enumClass = Props.enumFromProperty[p];
res.setPropValue(p, enumClass[v]);
}
}
}
}
return res;
}
/**
* Creates a Nub from the given properties, and associates it to the current form
*/
......
......@@ -371,7 +371,9 @@ export class FormulaireService extends Observable {
if (nub) {
f.currentNub = nub;
} else {
f.initNub();
const confProps = f.parseConfigToProps();
confProps.setPropValue("calcType", ct);
f.initNub(confProps);
}
// Restaure le nom du module, sinon affecte le nom par défaut
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment