[ADF-4788] Fix parsing of process variables from APS2 BE (#4972)

This commit is contained in:
davidcanonieto
2019-08-06 23:34:04 +01:00
committed by Eugenio Romano
parent 623b484673
commit 964e89f6ef
2 changed files with 1 additions and 11 deletions

View File

@@ -375,7 +375,7 @@ export class FormFieldModel extends FormWidgetModel {
case FormFieldTypes.UPLOAD: case FormFieldTypes.UPLOAD:
this.form.hasUpload = true; this.form.hasUpload = true;
if (this.value && this.value.length > 0) { if (this.value && this.value.length > 0) {
this.form.values[this.id] = this.value.map((elem) => elem.id).join(','); this.form.values[this.id] = Array.isArray(this.value) ? this.value.map((elem) => elem.id).join(',') : [this.value];
} else { } else {
this.form.values[this.id] = null; this.form.values[this.id] = null;
} }

View File

@@ -73,7 +73,6 @@ export class FormCloud extends FormBaseModel {
if (formData && formData.length > 0) { if (formData && formData.length > 0) {
this.loadData(formData); this.loadData(formData);
this.fixIncompatibilityFromPreviousAndNewForm(formData);
} }
for (let i = 0; i < this.fields.length; i++) { for (let i = 0; i < this.fields.length; i++) {
@@ -114,15 +113,6 @@ export class FormCloud extends FormBaseModel {
this.validateForm(); this.validateForm();
} }
fixIncompatibilityFromPreviousAndNewForm(formData) {
Object.keys(this.values).forEach( (propertyName) => {
const fieldValue = formData.find((value) => { return value.name === propertyName; });
if (fieldValue) {
this.values[propertyName] = fieldValue.value;
}
});
}
hasTabs(): boolean { hasTabs(): boolean {
return this.tabs && this.tabs.length > 0; return this.tabs && this.tabs.length > 0;
} }