feat: Implement mfr truncation fix and enhance invoice handling
Playwright Tests / test (push) Canceled after 0s

- Added a new SQL script to address the "String or binary data would be truncated" error in mfr sync by widening the Note fields in service objects and companies to NVARCHAR(MAX).
- Updated the table types and associated stored procedures to accommodate the changes, ensuring compatibility with existing data.
- Queued a re-sync for previously rejected rows due to truncation issues.
- Created application logins for fuchs_fds and fuchs_web with placeholder passwords for initial setup.
- Introduced functions for invoice backdating and invoice date retrieval to streamline invoice processing.
- Developed a password generation function with customizable parameters for length and character types.
- Added a random number generation function to support password creation.
This commit is contained in:
Stefan
2026-09-30 16:56:08 +02:00
parent 7357f60120
commit c741535aec
79 changed files with 2739 additions and 143 deletions
@@ -189,14 +189,14 @@ BEGIN
[MappingId] [nvarchar](255) NULL,
[ExternalId] [nvarchar](255) NULL,
[Name] [nvarchar](255) NULL,
[Note] [nvarchar](255) NULL,
[Note] [nvarchar](max) NULL,
[SupportTelephone] [nvarchar](255) NULL,
[SupportFax] [nvarchar](255) NULL,
[SupportMail] [nvarchar](255) NULL,
[QuickSearch] [nvarchar](255) NULL,
[DateModified] [datetime] NOT NULL,
[CustomValues] [nvarchar](max) NOT NULL,
[MainContactId] [bigint] NOT NULL,
[CustomValues] [nvarchar](max) NULL,
[MainContactId] [bigint] NULL,
[address] nvarchar(1000) null
);
INSERT INTO @company SELECT DISTINCT cy.*, [address] = [dbo].[fds__getCompanyAddress](cy.[id]) FROM [mfr__companies] as cy JOIN @SReq as s on cy.id = s.[CustomerId];
@@ -228,6 +228,7 @@ BEGIN
-- Add virtual items for intermediate invoices
With associated_interims as (
SELECT inv.InvoiceVAT_1
,[InvId] = inv.[Id] --carried as reference_InvId so fds__setInvoiceFinal can record the allocation
,inv.InvoiceBalance_net
,inv.DocumentName
,inv.DateCreated
@@ -259,7 +260,7 @@ BEGIN
,[NameOrNumber] = REPLACE(ai.DocumentName, '.pdf','')
,[CustomValues] = NULL
,[Note] = '<p>' + 'Anrechnung der ' + REPLACE(ai.DocumentName, '.pdf','') + ' vom ' + FORMAT(ai.[dateFinalized], 'dd.MM.yyyy', 'de-de') + '</p>'
,[ExternalId] = NULL
,[ExternalId] = ai.[InvId] --referenced intermediate invoice (-> reference_InvId)
,[Discount] = NULL
,[VAT] = ai.InvoiceVAT_1
,[IsManual] = 1
@@ -289,7 +290,7 @@ BEGIN
,[NameOrNumber] = 'offener Betrag aus ' + REPLACE(ai.DocumentName, '.pdf','')
,[CustomValues] = NULL
,[Note] = '<p>' + 'Berechnung des offenen Betrags aus ' + REPLACE(ai.DocumentName, '.pdf','') + ' vom ' + FORMAT(ai.[dateFinalized], 'dd.MM.yyyy', 'de-de') + '</p><p>bereits gezahlt (brutto): ' + FORMAT([payed], '0.00', 'de') + '€.</p>'
,[ExternalId] = NULL
,[ExternalId] = ai.[InvId] --referenced intermediate invoice (-> reference_InvId)
,[Discount] = NULL
,[VAT] = ai.InvoiceVAT_1
,[IsManual] = 1
@@ -393,6 +394,7 @@ BEGIN
, [Note] = IIF(ISNULL([Discount], 0) > 0, '<b>Rabatt '+ FORMAT([discount]*0.01,'#.0%','de-de') + '</b>', '') + ISNULL(itm.[Note],'')
, [order] = (itm.[baseorder] * 100) + itm.[order]
, [SetItmId]
, [reference_InvId] = CASE WHEN itm.[Type] IN ('IntInvoiceAllocation', 'IntInvoiceAllocationDiff') THEN CAST(itm.[ExternalId] as varchar(20)) ELSE NULL END
FROM @itm as itm
LEFT JOIN [dbo].[fds__custom_vat] as vat ON itm.[Id] = vat.[EntityId] and vat.[EntityType] = 'item';
END