From f25f664b9ab68768fc6761582cf06a28fc1c8f3f Mon Sep 17 00:00:00 2001 From: Laurie Montant Date: Thu, 15 Feb 2024 10:30:51 +0100 Subject: [PATCH] Modifs HsrPro --- RFXtoRP_HsrPro.ftl | 59 ++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/RFXtoRP_HsrPro.ftl b/RFXtoRP_HsrPro.ftl index 6f1864b..318d8e9 100644 --- a/RFXtoRP_HsrPro.ftl +++ b/RFXtoRP_HsrPro.ftl @@ -3,7 +3,7 @@ <#-- project : projectId in ReflexPlatform --> <#-- organisation : organisationtId in ReflexPlatform --> -<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> <#assign organisationRP = organisation> @@ -14,45 +14,48 @@ <#case "U"> <#-- *********************************************** Action = CREATE or UPDATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign preparation_order = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign preparation_order = JsonUtil.jsonToMap(dataRfx)> + [ { - <#-- check preparation type code (internal order and reservation are ignored) --> - <#if preparation_order.preparation_type_code == "010" || order.preparation_type_code == "030"> - - <#-- Only if preparation order not confirmed --> - <#if preparation_order.preparation_order_confirmed == "false" > - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrPro_ExecutionflowDetected.ftl"> - <#else> - <#stop "preparation order already confirmed"> - + <#if preparation_order.originator_reference?? && preparation_order.originator_reference!=""> + <#-- check preparation type code (internal order and reservation are ignored) --> + <#if preparation_order.preparation_type_code == "010" || order.preparation_type_code == "030"> + <#-- Only if preparation order not confirmed --> + <#if preparation_order.preparation_order_confirmed == "false" > + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_ExecutionflowDetected.ftl"> + <#else> + <#stop "preparation order already confirmed"> + + <#else> + <#stop "preparation order type not supported"> + <#else> - <#stop "preparation order type not supported"> - + <#stop "PRO reference is null"> + } - - ] + + ] <#break> - + <#case "D"> <#-- *********************************************** Action = DELETE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign preparation_order = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign preparation_order = JsonUtil.jsonToMap(dataRfx)> + [ { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrPro_ExecutionflowCancelled.ftl"> + "datas" : + <#include "RFXtoRP_HsrPro_ExecutionflowCancelled.ftl"> } - ] + ] <#break> - - + + <#default> <#stop "event not supported">