From 84d77a5a8ce1b5ba4766e9930c4ceb2febca5c45 Mon Sep 17 00:00:00 2001 From: "hamza.hramchi" <hamza.hramchi@xelians.fr> Date: Thu, 14 Jan 2021 19:07:27 +0100 Subject: [PATCH] FEAT #15550 TIME 0:05 fix duplicate signatures --- src/frontend/app/document/document.component.ts | 5 +++-- src/frontend/app/signatures/signatures.component.ts | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index fddbab21ec..6b0fdb9e0d 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -678,6 +678,9 @@ export class DocumentComponent implements OnInit { text: this.translate.instant('lang.validate'), handler: async (data: any) => { const currentUserWorkflow = this.mainDocument.workflow.filter((line: { current: boolean; }) => line.current === true)[0]; + + const massAction = await this.actionsService.checkGroupMail(this.mainDocument); + console.log('massAction', massAction); this.loadingController.create({ message: this.translate.instant('lang.loadingValidation'), spinner: 'dots', @@ -688,8 +691,6 @@ export class DocumentComponent implements OnInit { this.load.dismiss(); } }); - const massAction = await this.actionsService.checkGroupMail(this.mainDocument); - console.log('massAction', massAction); const res = await this.signatureMethodService.checkAuthenticationAndLaunchAction(currentUserWorkflow, data.paragraph); if (!this.functionsService.empty(res)) { if (this.signaturesService.documentsList[this.signaturesService.indexDocumentsList] !== undefined) { diff --git a/src/frontend/app/signatures/signatures.component.ts b/src/frontend/app/signatures/signatures.component.ts index 788c2dc7a9..9c4da1159d 100755 --- a/src/frontend/app/signatures/signatures.component.ts +++ b/src/frontend/app/signatures/signatures.component.ts @@ -124,19 +124,19 @@ export class SignaturesComponent implements OnInit { this.notificationService.success('lang.signatureInDocAdded'); this.modalController.dismiss('success'); } else { - if (signPosCurrentPage.length > 0) { + if (signPosCurrentPage.length > 0 && signPosOtherPage.length === 0) { signature.positionX = signPosCurrentPage[0].positionX; signature.positionY = signPosCurrentPage[0].positionY; this.storeSignature(signature, this.signaturesService.currentPage); } - let signaturePos = signPosOtherPage.filter((item: any) => item.sequence === this.posCurrentUser); + let signaturePos = this.currentWorflow.signaturePositions.filter((item: any) => item.sequence === this.posCurrentUser); if (signaturePos.length > 0) { signaturePos.forEach((element: { positionX: any; positionY: any; page: number; }) => { signature.positionX = element.positionX; signature.positionY = element.positionY; this.storeSignature(signature, element.page); }); - } else { + } else { signPosOtherPage.forEach((element: { positionX: any; positionY: any; page: number; }) => { signature.positionX = element.positionX; signature.positionY = element.positionY; @@ -158,13 +158,13 @@ export class SignaturesComponent implements OnInit { } } - if (signPosCurrentPage.length === 0 && signPosOtherPage.length > 0) { + if (signPosCurrentPage.length === 0 && signPosOtherPage.length > 0) { if (signaturePos.length > 0) { this.modalController.dismiss({ redirectPage: signaturePos[0].page }); } else { this.modalController.dismiss({ redirectPage: this.currentWorflow.signaturePositions[0].page }); } - } else { + } else { this.modalController.dismiss('success'); } } -- GitLab