[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:
this.form.hasUpload = true;
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 {
this.form.values[this.id] = null;
}

View File

@@ -73,7 +73,6 @@ export class FormCloud extends FormBaseModel {
if (formData && formData.length > 0) {
this.loadData(formData);
this.fixIncompatibilityFromPreviousAndNewForm(formData);
}
for (let i = 0; i < this.fields.length; i++) {
@@ -114,15 +113,6 @@ export class FormCloud extends FormBaseModel {
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 {
return this.tabs && this.tabs.length > 0;
}