From c37727e00069589973880dc6d0e03b31f182d38e Mon Sep 17 00:00:00 2001 From: Laurie Montant Date: Mon, 20 Jul 2026 16:35:30 +0200 Subject: [PATCH] SCPN1-11065 --- RFXtoRP_HsrReceiptList.ftl | 29 +++++++++++++++++------------ RFXtoRP_PlatformLogCreate.ftl | 23 ++++++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl index 02c1a42..30777a4 100644 --- a/RFXtoRP_HsrReceiptList.ftl +++ b/RFXtoRP_HsrReceiptList.ftl @@ -77,18 +77,23 @@ <#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl"> } <#else> - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl"> - } + <#if receipt.line_list ?? && receipt.line_list[0]??> + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl"> + } + <#else> + <#-- No line--> + <#stop> + <#else> <#if receipt.receipt_type == "030"> diff --git a/RFXtoRP_PlatformLogCreate.ftl b/RFXtoRP_PlatformLogCreate.ftl index ffa5985..ffd4790 100644 --- a/RFXtoRP_PlatformLogCreate.ftl +++ b/RFXtoRP_PlatformLogCreate.ftl @@ -1,7 +1,16 @@ <#include "HfRpConfig.ftl"> [ <#assign UUID = UUID.randomUUID()> - <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)> + <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")> + <#assign maxLen = 32000> + <#if strJsonBody?length gt maxLen> + <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")?replace('"logical_key_list"\\s*:\\s*\\[[^\\]]*\\]', '"logical_key_list": []', 'r')> + + <#if strJsonBody?length gt maxLen> + <#assign safeJsonBody = "{\"truncated\": true, \"original_size\": " + strJsonBody?length + "}"> + <#else> + <#assign safeJsonBody = strJsonBody> + { "Header": { "ProjectID": "${projectRP}" @@ -17,22 +26,22 @@ <#assign severity = SeverityLevel.ERROR> "Severity": "${severity}", "Namespace": "ReflexIntegration", - "DateTime": { - "DateTime": "${aDateTime?iso_utc}", - "AuthorTimeZone": "${time_zone_rfx}" + "DateTime": { + "DateTime": "${aDateTime?iso_utc}", + "AuthorTimeZone": "${time_zone_rfx}" }, "TechMessage": { "Code": "${restResponsetMsg.status!"no Code"}", - "Label": ${strJsonBody?truncate(32000,'...')} + "Label": "${safeJsonBody?json_string}" }, "UserMessage": { "Code": "${restResponsetMsg.status!"no Code"}", - "Label": ${strJsonBody?truncate(32000,'...')}, + "Label": "${safeJsonBody?json_string}", "Params": [] }, "DetailElements": [], "CorrelationID": "${id.correlationid!"no Correlationid"}", - "ContextPayload": ${strJsonBody?truncate(32000,'...')}, + "ContextPayload": "${safeJsonBody?json_string}", "Type": "${event}", "Task": "${id.apiRestReflexID!"no Task"}", "OriginalID": "${id.refid!"no OriginalID"?trim?json_string}",