From 75009531c8cea9fd90c9a73fa245b3d91b7ac950 Mon Sep 17 00:00:00 2001
From: "hamza.hramchi" <hamza.hramchi@xelians.fr>
Date: Fri, 19 Mar 2021 16:11:03 +0100
Subject: [PATCH] FEAT #16662 TIME 0:08 wording of direct mail alert in case of
 refusal

---
 lang/fr.json                                    | 3 ++-
 src/frontend/app/document/document.component.ts | 4 ++--
 src/frontend/app/service/actions.service.ts     | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lang/fr.json b/lang/fr.json
index 82e7b148e5..5cc2f9295b 100755
--- a/lang/fr.json
+++ b/lang/fr.json
@@ -461,6 +461,7 @@
 		"filter": "Filtrer",
 		"noItem": "Aucun élément",
 		"modelCreated": "Modèle créé",
-		"undefined": "Non défini"
+		"undefined": "Non défini",
+		"refuseActionDocInMailGroup": "Voulez-vous refuser les autres documents ?"
 	}
 }
diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts
index 13c855dbc3..f6c4e4d220 100755
--- a/src/frontend/app/document/document.component.ts
+++ b/src/frontend/app/document/document.component.ts
@@ -609,7 +609,7 @@ export class DocumentComponent implements OnInit {
                 {
                     text: this.translate.instant('lang.reject'),
                     handler: async (data: any) => {
-                        const idsToProcess = await this.actionsService.checkGroupMail(this.mainDocument);
+                        const idsToProcess = await this.actionsService.checkGroupMail(this.mainDocument, 'reject');                        
 
                         const res = await this.signatureMethodService.launchDefaultMode(data.paragraph, idsToProcess);
 
@@ -654,7 +654,7 @@ 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 idsToProcess = await this.actionsService.checkGroupMail(this.mainDocument);
+                        const idsToProcess = await this.actionsService.checkGroupMail(this.mainDocument, 'validate');
 
                         const res = await this.signatureMethodService.checkAuthenticationAndLaunchAction(currentUserWorkflow, data.paragraph, idsToProcess);
 
diff --git a/src/frontend/app/service/actions.service.ts b/src/frontend/app/service/actions.service.ts
index 22701d3ac5..b50168ca4c 100644
--- a/src/frontend/app/service/actions.service.ts
+++ b/src/frontend/app/service/actions.service.ts
@@ -150,7 +150,7 @@ export class ActionsService {
         });
     }
 
-    checkGroupMail(mainDocument: any): Promise<any[]> {
+    checkGroupMail(mainDocument: any, action: string): Promise<any[]> {
         return new Promise(async (resolve) => {
             if (this.functionsService.empty(mainDocument.mailingId)) {
                 resolve([this.signaturesService.mainDocumentId]);
@@ -161,7 +161,7 @@ export class ActionsService {
                             if (res.documents.length > 1) {
                                 const alert = await this.alertController.create({
                                     header: this.translate.instant('lang.mailing'),
-                                    message: this.translate.instant('lang.makeActionOnDocInMailGroup'),
+                                    message: action === 'validate' ? this.translate.instant('lang.makeActionOnDocInMailGroup') : this.translate.instant('lang.refuseActionDocInMailGroup'),
                                     backdropDismiss: false,
                                     buttons: [
                                         {
-- 
GitLab