Commit e26df147 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #16956 TIME 2 signature position for external user if mandatory

parent 7609bbf9
......@@ -80,10 +80,14 @@ export class SendExternalSignatoryBookActionComponent implements OnInit {
this.checkExternalSignatureBook();
}
onSubmit() {
this.loading = true;
if (this.data.resIds.length > 0) {
this.executeAction();
async onSubmit() {
if (this.hasEmptyOtpSignaturePosition()) {
this.notify.error(this.translate.instant('lang.mustSign'));
} else {
this.loading = true;
if (this.data.resIds.length > 0) {
this.executeAction();
}
}
}
......@@ -176,4 +180,26 @@ export class SendExternalSignatoryBookActionComponent implements OnInit {
this.resourcesToSign.splice(index, 1);
}
}
hasEmptyOtpSignaturePosition() {
const externalUsers: any[] = this.maarchParapheur.appExternalVisaWorkflow.visaWorkflow.items.filter((user: any) => user.item_id === null);
if (externalUsers.length > 0) {
let resToSign: any[] = this.maarchParapheur.resourcesToSign.filter((res: any) => res.hasOwnProperty('signaturePositions'));
let mustSign: boolean = false;
if (this.maarchParapheur.resourcesToSign.length - resToSign.length >= 1) {
return true;
} else {
resToSign = resToSign.map((res: any) => res.signaturePositions);
externalUsers.forEach((element: any, index: number) => {
for (let i = 0; i < resToSign.length; i++) {
if (resToSign[i].filter((item: any) => item.sequence === index).length === 0) {
mustSign = true;
break;
}
}
});
return mustSign;
}
}
}
}
......@@ -2512,5 +2512,6 @@
"viewSuggestions": "Voir les suggestions",
"noSuggestion": "Aucune suggestion",
"contactsParameters_sector": "Secteur",
"otpVisaUser": "L'utilisateur sera notifié par <b>courriel</b> au moment de son tour dans le circuit."
"otpVisaUser": "L'utilisateur sera notifié par <b>courriel</b> au moment de son tour dans le circuit.",
"mustSign": "La position de signature pour les utilisateurs externes est obligatoire."
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment