Skip to content

Commit

Permalink
fix(mapping) fix mandatory field on synthese import
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Narcisi committed Dec 9, 2024
1 parent 2ae5a3b commit 3a77fe7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/src/app/GN2CommonModule/form/form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class FormService {
currentControl: AbstractControl
): boolean {
let result = false;
if (referenceControlNames.length === 0) return true;
referenceControlNames.forEach((referenceControlName) => {
const referenceControl = currentControl.parent.get(referenceControlName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class FieldMappingService {
.setValidators(
this._formservice.RequiredIfControlIsNotNullValidator(
mandatory_conditions,
this.fieldsByEntity.get(entity.label)
this.targetFieldsData.length > 1 ? this.fieldsByEntity.get(entity.label) : []
)
);
}
Expand All @@ -277,14 +277,16 @@ export class FieldMappingService {
.setValidators(
this._formservice.NotRequiredIfControlIsNotNullValidator(
optional_conditions,
this.fieldsByEntity.get(entity.label)
this.targetFieldsData.length > 1 ? this.fieldsByEntity.get(entity.label) : []
)
);
} else if (mandatory) {
this.mappingFormGroup
.get(name_field)
.setValidators(
this._formservice.NotRequiredIfNoOther(this.fieldsByEntity.get(entity.label))
this._formservice.NotRequiredIfNoOther(
this.targetFieldsData.length > 1 ? this.fieldsByEntity.get(entity.label) : []
)
);
}

Expand Down

0 comments on commit 3a77fe7

Please sign in to comment.