You've already forked reflex-wms-connector
release1.2-SCPN1-11488 into release/1.2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<#-- --------------------------------------------------------------------------------------- -->
|
||||
<#-- Concat reflex timestamp with reflex time zone and format this date in ISO UTC format -->
|
||||
<#-- --------------------------------------------------------------------------------------- -->
|
||||
<#-- -------------------------------------------------------------------------------------------- -->
|
||||
<#-- 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>
|
||||
@@ -25,24 +25,48 @@
|
||||
<#return (endDate?long - startDate?long) / 1000 >
|
||||
</#function>
|
||||
|
||||
|
||||
<#-- --------------------------------------------------------------------------------------- -->
|
||||
<#-- Split email reflex into json array string -->
|
||||
<#-- 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>
|
||||
<#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>
|
||||
|
||||
<#-- --------------------------------------------------------------------------------------- -->
|
||||
<#-- validate and convert HARDIS WMS date field into UTC timestamp -->
|
||||
<#-- Example : RfxDatetoTimestampUTC("2025-11-00", "yyyy-MM-dd) -->
|
||||
<#-- return "2025-11-00T00:00:00Z" -->
|
||||
<#-- --------------------------------------------------------------------------------------- -->
|
||||
<#-- Default timestamp to use in case of invalid date -->
|
||||
<#assign DEFAULT_TIMESTAMP = "1970-01-01T00:00:00Z">
|
||||
<#function RfxDatetoTimestampUTC rfxdate rfx_date_format >
|
||||
<#local fallback = DEFAULT_TIMESTAMP>
|
||||
|
||||
<#if !rfxdate?matches("[0-9]*-[0-9]*-[0-9]*")>
|
||||
<#return fallback>
|
||||
</#if>
|
||||
|
||||
<#attempt>
|
||||
<#if rfxdate?? && rfxdate == rfxdate?date(rfx_date_format)?string(rfx_date_format) >
|
||||
<#return rfxdate?datetime(rfx_date_format)?iso_utc>,
|
||||
<#else>
|
||||
<#return fallback>
|
||||
</#if>
|
||||
<#recover>
|
||||
<#return fallback>
|
||||
</#attempt>
|
||||
</#function>
|
||||
Reference in New Issue
Block a user