From 6af4ebff6266cd1bca07e500333df780716755d6 Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Wed, 18 Dec 2024 19:41:31 +0100 Subject: [PATCH 1/4] Changed method name to by used as callback method --- src/Storage/Helpers/A2FormServerXslFunction.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Storage/Helpers/A2FormServerXslFunction.cs b/src/Storage/Helpers/A2FormServerXslFunction.cs index 81133dba..45e3f11b 100644 --- a/src/Storage/Helpers/A2FormServerXslFunction.cs +++ b/src/Storage/Helpers/A2FormServerXslFunction.cs @@ -638,7 +638,8 @@ public string Today() /// /// Formatted string /// - public string FormatString(string str, string type, string format) + [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Must match infopath callback name")] + public string formatString(string str, string type, string format) { try { From eafa8a294fa8c3989fc880896477e2b934be2eaa Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Wed, 18 Dec 2024 21:36:07 +0100 Subject: [PATCH 2/4] Converted timestamp in watermark to localtime --- src/Storage/Controllers/ContentOnDemandController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Controllers/ContentOnDemandController.cs b/src/Storage/Controllers/ContentOnDemandController.cs index 8d81fb87..5fbb8e0d 100644 --- a/src/Storage/Controllers/ContentOnDemandController.cs +++ b/src/Storage/Controllers/ContentOnDemandController.cs @@ -237,7 +237,7 @@ private async Task GetFormdataAsHtmlString(string app, Guid instanceGuid xsls[^1].LastPage = true; - string watermark = ((DateTime)xmlElement.Created).ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture) + string watermark = ((DateTime)xmlElement.Created).ToLocalTime().ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture) + $" AR{instance.DataValues["A2ArchRef"]}"; return _a2OndemandFormattingService.GetFormdataHtml( xsls, From b02857b77954efbddf7fcae7d1c5627f65359646 Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Wed, 18 Dec 2024 23:47:16 +0100 Subject: [PATCH 3/4] - Changed source of watermark timestamp to avoid timezone problems - Made date functions in A2FormServerXslFunction InvariantCulture --- src/Storage/Controllers/ContentOnDemandController.cs | 2 +- src/Storage/Helpers/A2FormServerXslFunction.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Storage/Controllers/ContentOnDemandController.cs b/src/Storage/Controllers/ContentOnDemandController.cs index 5fbb8e0d..a3aba22c 100644 --- a/src/Storage/Controllers/ContentOnDemandController.cs +++ b/src/Storage/Controllers/ContentOnDemandController.cs @@ -237,7 +237,7 @@ private async Task GetFormdataAsHtmlString(string app, Guid instanceGuid xsls[^1].LastPage = true; - string watermark = ((DateTime)xmlElement.Created).ToLocalTime().ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture) + string watermark = ((DateTime)instance.Created).ToLocalTime().ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture) + $" AR{instance.DataValues["A2ArchRef"]}"; return _a2OndemandFormattingService.GetFormdataHtml( xsls, diff --git a/src/Storage/Helpers/A2FormServerXslFunction.cs b/src/Storage/Helpers/A2FormServerXslFunction.cs index 45e3f11b..6ec732e8 100644 --- a/src/Storage/Helpers/A2FormServerXslFunction.cs +++ b/src/Storage/Helpers/A2FormServerXslFunction.cs @@ -702,8 +702,7 @@ public string formatString(string str, string type, string format) break; default: - int locale = int.Parse(formatParams["locale"].ToString()); - dateStr = date.ToString(formatString, new CultureInfo(locale)); + dateStr = date.ToString(formatString, CultureInfo.InvariantCulture); break; } From 121038f486fcd0e3cad47bc9e9c6afaddd142781 Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Thu, 19 Dec 2024 07:55:25 +0100 Subject: [PATCH 4/4] Use formatted timestamp from a2 in watermark --- src/Storage/Controllers/ContentOnDemandController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Storage/Controllers/ContentOnDemandController.cs b/src/Storage/Controllers/ContentOnDemandController.cs index a3aba22c..6d6c1caa 100644 --- a/src/Storage/Controllers/ContentOnDemandController.cs +++ b/src/Storage/Controllers/ContentOnDemandController.cs @@ -237,7 +237,8 @@ private async Task GetFormdataAsHtmlString(string app, Guid instanceGuid xsls[^1].LastPage = true; - string watermark = ((DateTime)instance.Created).ToLocalTime().ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture) + instance.DataValues.TryGetValue("A2ArchRefTs", out string watermark); + watermark = (watermark ?? ((DateTime)instance.Created).ToLocalTime().ToString("dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture)) + $" AR{instance.DataValues["A2ArchRef"]}"; return _a2OndemandFormattingService.GetFormdataHtml( xsls,