From 8ec30397dc54235aadaecab1eab8c488349f65ad Mon Sep 17 00:00:00 2001 From: lhameury <43-lhameury@users.noreply.gitlab.libriciel.fr> Date: Tue, 14 Jan 2025 14:38:06 +0100 Subject: [PATCH] Fix counters for mailsec action --- .../pastell/mailsec/MailsecPastellService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/jscript/pastell/mailsec/MailsecPastellService.java b/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/jscript/pastell/mailsec/MailsecPastellService.java index 9a811eb..eb2aa68 100644 --- a/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/jscript/pastell/mailsec/MailsecPastellService.java +++ b/iparapheur-core/src/main/java/org/adullact/iparapheur/repo/jscript/pastell/mailsec/MailsecPastellService.java @@ -1,6 +1,7 @@ package org.adullact.iparapheur.repo.jscript.pastell.mailsec; import com.atolcd.parapheur.model.ParapheurModel; +import com.atolcd.parapheur.repo.CorbeillesService; import com.atolcd.parapheur.repo.EtapeCircuit; import com.atolcd.parapheur.repo.ParapheurService; import com.atolcd.parapheur.repo.TypesService; @@ -69,6 +70,8 @@ public class MailsecPastellService { private TransactionService transactionService; @Autowired private AuthenticationService authenticationService; + @Autowired + private CorbeillesService corbeillesService; private String connectorHost; private String connectorPort; @@ -373,8 +376,16 @@ public class MailsecPastellService { String serverId = payload.getString(SERVER_ID_PAYLOAD); String mailId = object.getString(DOCUMENT_ID_KEY); + NodeRef parentCourant = null; + if(nodeService.exists(node)) { + parentCourant = nodeService.getPrimaryParent(node).getParentRef(); + } + AuthenticationUtil.runAs(() -> transactionService.getRetryingTransactionHelper().doInTransaction(() -> approveMailsec(annotation, node, user, serverId, mailId)), user); + if(parentCourant != null) { + corbeillesService.moveDossier(node, parentCourant, nodeService.getPrimaryParent(node).getParentRef()); + } } catch (JSONException | IOException e) { e.printStackTrace(); } -- GitLab