feat: implement set-based invoice payment calculations and enhance email logging configuration
Playwright Tests / test (push) Canceled after 0s

This commit is contained in:
Stefan
2026-09-16 22:31:27 +02:00
parent 944a5bb442
commit 86f6a60860
8 changed files with 268 additions and 12 deletions
@@ -2,6 +2,10 @@
returns table
as return
-- [config] is NOT NULL but a logging path may have stored '' (or otherwise non-JSON text).
-- OPENJSON/JSON_QUERY raise on that and took the whole widget down, so the JSON is normalised
-- once (invalid -> '{}') before anything parses it; a WHERE ISJSON() alone is not guaranteed to
-- be evaluated ahead of the CROSS APPLY.
SELECT TOP (@count)
[Betreff] = oj.[subject],
[Empfänger] = (SELECT STRING_AGG(
@@ -9,9 +13,10 @@ SELECT TOP (@count)
THEN SUBSTRING([value], CHARINDEX('<', [value]) + 1, CHARINDEX('>', [value]) - CHARINDEX('<', [value]) - 1)
ELSE [value]
END, ', ')
FROM OPENJSON(JSON_QUERY(el.[config], '$.to'))),
[attachments] = (SELECT STRING_AGG([value], ', ') FROM OPENJSON(JSON_QUERY(el.[config], '$.attachments'))),
FROM OPENJSON(JSON_QUERY(j.[cfg], '$.to'))),
[attachments] = (SELECT STRING_AGG([value], ', ') FROM OPENJSON(JSON_QUERY(j.[cfg], '$.attachments'))),
[gesendet] = FORMAT(el.DateSent, 'dd.MM.yy', 'de-DE')
FROM [dbo].[fds__emaillog] as el
CROSS APPLY OPENJSON(el.[config], '$') WITH ( [subject] nvarchar(255) '$.subject' ) as oj
CROSS APPLY (SELECT [cfg] = IIF(ISJSON(el.[config]) = 1, el.[config], N'{}')) as j
CROSS APPLY OPENJSON(j.[cfg], '$') WITH ( [subject] nvarchar(255) '$.subject' ) as oj
order by [DateSent] desc