reflex-wms-connector/ReflexUtils.ftl
Laurie Montant ceb33abfca SCPN1-9601
(cherry picked from commit 9214df8b96ef9f8864bae3d7ab49ca4fdc6f6c43)
2025-11-04 10:22:37 +01:00

31 lines
1.4 KiB
Java

<#-- --------------------------------------------------------------------------------------- -->
<#-- Concat HARDIS WMS timestamp with HARDIS WMS time zone and format this date in ISO UTC format -->
<#-- --------------------------------------------------------------------------------------- -->
<#function RfxDateTimetoUTC rfxdatetime offset >
<#return ((rfxdatetime + offset)?datetime.iso?iso_utc)>
</#function>
<#function DateTimeUTCtoRfxLocale dateutc locale >
<#return dateutc?datetime.iso?iso_nz(locale)>
</#function>
<#-- --------------------------------------------------------------------------------------- -->
<#-- Split email HARDIS WMS into json array string -->
<#-- Example : splitemail "john.doe@hardis-group.com,; name@hardis-group.com" -->
<#-- return "["john.doe@hardis-group.com","name@hardis-group.com"]" -->
<#-- --------------------------------------------------------------------------------------- -->
<#function splitEmailsIntoArray emails >
<#local str = "[">
<#list emails?split(";|,| |à|/","r")?filter(l -> l != "") as email>
<#if email?matches("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$")>
<#if str != "[">
<#local str += ",">
</#if>
<#local str += "\"">
<#local str += email>
<#local str += "\"">
</#if>
</#list>
<#local str += "]">
<#return (str)>
</#function>