From ee27462cc43217b78e93933821f1b5df6a3088cb Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 7 Jul 2026 13:34:41 +0200 Subject: [PATCH 1/7] Add Standard/Evaluation DemoTool smoke test to Legacy CI BCApps legacy tests only generate Extended demo data, so the Standard/Evaluation generation path (Interface Trial Data.CreateSetupData, CU122000) is never exercised. Bugs there only surface later in the NAV translated-country build. Add an opt-in smoke test (gated by the smokeTestDemoDataTypes AL-Go setting) that runs the legacy DemoTool for the requested non-Extended data types against throwaway companies, before the real Extended test company is built, so it cannot affect the demo data tests run against. Enabled on Test Apps NL (Standard + Evaluation) as the proving ground. --- .../Test Apps NL/.AL-Go/settings.json | 3 +- build/scripts/ImportTestDataInBcContainer.ps1 | 81 ++++++++++++++++++- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/build/projects/Test Apps NL/.AL-Go/settings.json b/build/projects/Test Apps NL/.AL-Go/settings.json index 2cd87f6327..66594250aa 100644 --- a/build/projects/Test Apps NL/.AL-Go/settings.json +++ b/build/projects/Test Apps NL/.AL-Go/settings.json @@ -47,7 +47,8 @@ "settings": { "testType": "Legacy", "bucketNumber": 1, - "companyName": "CRONUS International Ltd." + "companyName": "CRONUS International Ltd.", + "smokeTestDemoDataTypes": [ "Standard", "Evaluation" ] } }, { diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index f3f4f5fd75..00ea2800b0 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -337,7 +337,9 @@ function Invoke-LegacyDemoDataTool() { [string]$ContainerName, [string]$CompanyName = (Get-TestCompanyName), [PSCredential]$Credential, - [string]$Tenant = "default" + [string]$Tenant = "default", + [ValidateSet("Standard","Evaluation","Extended")] + [string]$DemoDataType = "Extended" ) $ErrorActionPreference = "Stop" @@ -347,11 +349,74 @@ function Invoke-LegacyDemoDataTool() { $countryCode = Get-CountryCodeFromSettings - Initialize-DemoToolResources -ContainerName $ContainerName -CountryCode $countryCode + Initialize-DemoToolResources -ContainerName $ContainerName -CountryCode $countryCode -DemoDataType $DemoDataType Invoke-DemoToolPageAction -ContainerName $ContainerName -CompanyName $CompanyName -Credential $Credential -Tenant $Tenant } +<# +.SYNOPSIS + Smoke-tests the legacy DemoTool for one or more non-Extended data types against a throwaway company. +.DESCRIPTION + BCApps legacy tests only generate Extended demo data, so the Standard/Evaluation generation path + ('Interface Trial Data'.CreateSetupData, CU122000) is never exercised in BCApps CI. Bugs on that path + (e.g. a missing localization DemoTool override assigning a non-existent G/L account) therefore only + surface later in the NAV translated-country build, which loops Standard/Evaluation/Extended. + + This function closes that gap: for each requested data type it creates a disposable company, runs the + legacy DemoTool into it, and removes it again. It is designed to run BEFORE the real (Extended) test + company is built. Because New-TestCompany subsequently deletes all companies and recreates the real one + from a clean slate, this smoke test cannot interfere with the demo data the tests actually run against. + + The DemoTool bug class this targets throws DURING generation (before any rapidstart export), so a + throwaway-company run reliably reproduces it without needing the full generate/export/delete pipeline. +.PARAMETER DemoDataTypes + One or more of "Standard","Evaluation". Extended is skipped here because it is already covered by the + real test-company generation. +#> +function Invoke-LegacyDemoDataSmokeTest() { + param( + [Parameter(Mandatory=$true)] + [string]$ContainerName, + [PSCredential]$Credential, + [string]$Tenant = "default", + [string[]]$DemoDataTypes = @("Standard") + ) + + $ErrorActionPreference = "Stop" + + foreach ($demoDataType in $DemoDataTypes) { + if ($demoDataType -eq "Extended") { + Write-Host "Skipping Extended in demo-data smoke test (already covered by the real test company)" + continue + } + + $smokeCompanyName = "Smoke $demoDataType" + Write-Host "=== Legacy DemoTool smoke test: DataType=$demoDataType (throwaway company '$smokeCompanyName') ===" + + # Evaluation demo data requires an evaluation company; Standard uses a normal company. + $isEvaluation = ($demoDataType -eq "Evaluation") + + try { + Write-Host "Creating throwaway company '$smokeCompanyName' (evaluation=$isEvaluation)" + New-CompanyInBcContainer -containerName $ContainerName -companyName $smokeCompanyName -evaluationCompany:$isEvaluation + + Invoke-LegacyDemoDataTool -ContainerName $ContainerName -CompanyName $smokeCompanyName ` + -Credential $Credential -Tenant $Tenant -DemoDataType $demoDataType + + Write-Host "Legacy DemoTool smoke test for DataType=$demoDataType succeeded" + } catch { + throw "Legacy DemoTool smoke test FAILED for DataType=$demoDataType (country $(Get-CountryCodeFromSettings)). This path is exercised by the NAV translated-country build but not by BCApps Extended-only demo data. Error: $($_.Exception.Message)" + } finally { + # Always remove the throwaway company so it never lingers into the real test run. + if (Get-CompanyInBcContainer -containerName $ContainerName | Where-Object { $_.CompanyName -eq $smokeCompanyName }) { + Write-Host "Removing throwaway company '$smokeCompanyName'" + Remove-CompanyInBcContainer -containerName $ContainerName -companyName $smokeCompanyName + } + } + } +} + <# .SYNOPSIS Opens page 101900 via ClientContext and invokes the "Create Demo Data from Config" action. @@ -735,6 +800,18 @@ function Invoke-DemoDataGeneration Invoke-ContosoDemoToolWithRetry -ContainerName $ContainerName -CompanyName (Get-TestCompanyName) } elseif ( $TestType -eq "Legacy" ) { Install-BaseAppsForDemoTool -ContainerName $ContainerName -CountryCode (Get-CountryCodeFromSettings) + + # Optional: smoke-test non-Extended demo data (Standard/Evaluation) against throwaway companies + # BEFORE building the real Extended test company. This catches DemoTool bugs on the + # 'Interface Trial Data'.CreateSetupData path that otherwise only fail in the NAV translated-country + # build. Gated by the "smokeTestDemoDataTypes" AL-Go setting (array, e.g. ["Standard"]); when unset + # or empty, behavior is unchanged. Runs before New-TestCompany, which wipes all companies and + # recreates the real one, guaranteeing the smoke run cannot affect the demo data tests run against. + $smokeTestDemoDataTypes = Get-ALGoSetting -Key "smokeTestDemoDataTypes" + if ($smokeTestDemoDataTypes -and $smokeTestDemoDataTypes.Count -gt 0) { + Invoke-LegacyDemoDataSmokeTest -ContainerName $ContainerName -Credential $Credential -Tenant $Tenant -DemoDataTypes $smokeTestDemoDataTypes + } + New-TestCompany -ContainerName $ContainerName -CompanyName (Get-TestCompanyName) Write-Host "Proceeding with full demo data generation as test type is set to Legacy" Invoke-LegacyDemoDataTool -ContainerName $ContainerName -Credential $Credential -Tenant $Tenant From 870f61c1e9f091c5b82d2b0d15cf2ca1fa063bf4 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 7 Jul 2026 13:34:49 +0200 Subject: [PATCH 2/7] Revert "re-added createcurrency for NL (#9135)" This reverts commit 1d5d7be5dc9b7476da8e165674c0edc404f343ba. --- .../NL/DemoTool/CreateCurrency.Codeunit.al | 656 ------------------ 1 file changed, 656 deletions(-) delete mode 100644 src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al diff --git a/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al b/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al deleted file mode 100644 index 04562bdc7e..0000000000 --- a/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al +++ /dev/null @@ -1,656 +0,0 @@ -codeunit 101004 "Create Currency" -{ - // // To change or update exchange rates, please change the values in the CurrencyData.txt file - // //in the pictures folder. - - TableNo = "Temporary Currency Data"; - - trigger OnRun() - begin - DemoDataSetup.Get(); - Reset(); - if FindSet() then - repeat - InsertData(Rec); - InsertExchRateData(Rec); - until Next() = 0 - else - Error(NoCurrencyFoundErr); - - if not Skip then begin - DemoDataSetup.TestField("Currency Code"); - TempCurrencyData.Get(DemoDataSetup."Currency Code"); - DemoDataSetup.Validate("Local Precision Factor", TempCurrencyData."Local Precision Factor"); - DemoDataSetup."Local Currency Factor" := - Round(TempCurrencyData."Exchange Rate Amount" / TempCurrencyData."Relational Exch. Rate Amount", 0.0001); - DemoDataSetup.Modify(); - - "Create Currency Exchange Rate".LocalizeExchangeRates(); - - SetLCYinGLSetup(DemoDataSetup."Currency Code"); - end; - end; - - var - TempCurrencyData: Record "Temporary Currency Data"; - DemoDataSetup: Record "Demo Data Setup"; - Currency: Record Currency; - CA: Codeunit "Make Adjustments"; - "Create Currency Exchange Rate": Codeunit "Create Currency Exchange Rate"; - Skip: Boolean; - XEuroTxt: Label 'Euro'; - XAustraliandollarTxt: Label 'Australian dollar'; - XBulgarianlevaTxt: Label 'Bulgarian leva'; - XBruneiDarussalemdollarTxt: Label 'Brunei Darussalam dollar'; - XBrazilianrealTxt: Label 'Brazilian real'; - XCanadiandollarTxt: Label 'Canadian dollar'; - XCroatianKunaTxt: Label 'Croatian Kuna'; - XSwissfrancTxt: Label 'Swiss franc'; - XCzechkorunaTxt: Label 'Czech koruna'; - XDanishkroneTxt: Label 'Danish krone'; - XEstoniankroonTxt: Label 'Estonian kroon'; - XFijidollarTxt: Label 'Fiji dollar'; - XBritishpoundTxt: Label 'Pound Sterling'; - XHongKongdollarTxt: Label 'Hong Kong dollar'; - XIndonesianrupiahTxt: Label 'Indonesian rupiah'; - XJapaneseyenTxt: Label 'Japanese yen'; - XIndianrupeeTxt: Label 'Indian rupee'; - XIcelandickronaTxt: Label 'Icelandic krona'; - XMalaysianringgitTxt: Label 'Malaysian ringgit'; - XMexicanpesoTxt: Label 'Mexican peso'; - XNorwegiankroneTxt: Label 'Norwegian krone'; - XNewZealanddollarTxt: Label 'New Zealand dollar'; - XPhilippinespesoTxt: Label 'Philippines peso'; - XPolishzlotyTxt: Label 'Polish zloty'; - XRussianrubleTxt: Label 'Russian ruble'; - XSwedishkronaTxt: Label 'Swedish krona'; - XSingaporedollarTxt: Label 'Singapore dollar'; - XSloveniantolarTxt: Label 'Slovenian tolar'; - XSaudiArabianryialTxt: Label 'Saudi Arabian ryial'; - XSolomonIslandsdollarTxt: Label 'Solomon Islands dollar'; - XThaibahtTxt: Label 'Thai baht'; - XUSdollarTxt: Label 'US dollar'; - XVanuatuvatuTxt: Label 'Vanuatu vatu'; - XWesternSamoantalaTxt: Label 'Western Samoan tala'; - XSouthAfricanrandTxt: Label 'South African rand'; - XUnitedArabEmiratesdirhamTxt: Label 'United Arab Emirates dirham'; - XAlgeriandinarTxt: Label 'Algerian dinar'; - XHungarianforintTxt: Label 'Hungarian forint'; - XKenyanShillingTxt: Label 'Kenyan Shilling'; - XMoroccandirhamTxt: Label 'Moroccan dirham'; - XMozambiquemeticalTxt: Label 'Mozambique metical'; - XNigeriannairaTxt: Label 'Nigerian naira'; - XRomanianleuTxt: Label 'Romanian leu'; - XSwazilandlilangeniTxt: Label 'Swaziland lilangeni'; - XSlovakKorunaTxt: Label 'Slovak Koruna'; - XSerbianDinarTxt: Label 'Serbian Dinar'; - XTunisiandinarTxt: Label 'Tunisian dinar'; - XUgandanShillingTxt: Label 'Ugandan Shilling'; - XMacedonianDenarTxt: Label 'Macedonian Denar'; - XChineseYuanTxt: Label 'Chinese Yuan'; - XAfghaniTxt: Label 'Afghani'; - XArgentinePesoTxt: Label 'Argentine Peso'; - XArmenianDramTxt: Label 'Armenian Dram'; - XArubanFlorinTxt: Label 'Aruban Florin'; - XAzerbaijanManatTxt: Label 'Azerbaijan Manat'; - XBahamianDollarTxt: Label 'Bahamian Dollar'; - XBahrainiDinarTxt: Label 'Bahraini Dinar'; - XBalboaTxt: Label 'Balboa'; - XBarbadosDollarTxt: Label 'Barbados Dollar'; - XBelarusianRubleTxt: Label 'Belarusian Ruble'; - XBelizeDollarTxt: Label 'Belize Dollar'; - XBermudianDollarTxt: Label 'Bermudian Dollar'; - XBolivarSoberanoTxt: Label 'Bolivar Soberano'; - XBolivianoTxt: Label 'Boliviano'; - XBurundiFrancTxt: Label 'Burundi Franc'; - XCaboVerdeEscudoTxt: Label 'Cabo Verde Escudo'; - XCaribbeanGuilderTxt: Label 'Caribbean Guilder'; - XCaymanIslandsDollarTxt: Label 'Cayman Islands Dollar'; - XCfaFrancBceaoTxt: Label 'Cfa Franc Bceao'; - XChileanPesoTxt: Label 'Chilean Peso'; - XColombianPesoTxt: Label 'Colombian Peso'; - XComorianFrancTxt: Label 'Comorian Franc'; - XCongoleseFrancTxt: Label 'Congolese Franc'; - XConvertibleMarkTxt: Label 'Convertible Mark'; - XCordobaOroTxt: Label 'Cordoba Oro'; - XCostaRicanColonTxt: Label 'Costa Rican Colon'; - XCubanPesoTxt: Label 'Cuban Peso'; - XDalasiTxt: Label 'Dalasi'; - XDjiboutiFrancTxt: Label 'Djibouti Franc'; - XDobraTxt: Label 'Dobra'; - XDominicanPesoTxt: Label 'Dominican Peso'; - XDongTxt: Label 'Dong'; - XCentralAfricaFrancTxt: Label 'Central African CFA Franc'; - XEastCaribbeanDollarTxt: Label 'East Caribbean Dollar'; - XEgyptianPoundTxt: Label 'Egyptian Pound'; - XElSalvadorColonTxt: Label 'El Salvador Colon'; - XEthiopianBirrTxt: Label 'Ethiopian Birr'; - XFalklandIslandsPoundTxt: Label 'Falkland Islands Pound'; - XGhanaCediTxt: Label 'Ghana Cedi'; - XGibraltarPoundTxt: Label 'Gibraltar Pound'; - XGourdeTxt: Label 'Gourde'; - XGuaraniTxt: Label 'Guarani'; - XGuineanFrancTxt: Label 'Guinean Franc'; - XGuyanaDollarTxt: Label 'Guyana Dollar'; - XHryvniaTxt: Label 'Hryvnia'; - XIranianRialTxt: Label 'Iranian Rial'; - XIraqiDinarTxt: Label 'Iraqi Dinar'; - XJamaicanDollarTxt: Label 'Jamaican Dollar'; - XJordanianDinarTxt: Label 'Jordanian Dinar'; - XKinaTxt: Label 'Kina'; - XKuwaitiDinarTxt: Label 'Kuwaiti Dinar'; - XKwanzaTxt: Label 'Kwanza'; - XKyatTxt: Label 'Kyat'; - XLaoKipTxt: Label 'Lao Kip'; - XLariTxt: Label 'Lari'; - XLebanesePoundTxt: Label 'Lebanese Pound'; - XLekTxt: Label 'Lek'; - XLempiraTxt: Label 'Lempira'; - XLeoneTxt: Label 'Leone'; - XLiberianDollarTxt: Label 'Liberian Dollar'; - XLibyanDinarTxt: Label 'Libyan Dinar'; - XLotiTxt: Label 'Loti'; - XMalagasyAriaryTxt: Label 'Malagasy Ariary'; - XMalawiKwachaTxt: Label 'Malawi Kwacha'; - XMauritiusRupeeTxt: Label 'Mauritius Rupee'; - XMoldovanLeuTxt: Label 'Moldovan Leu'; - XMvdolTxt: Label 'Mvdol'; - XNakfaTxt: Label 'Nakfa'; - XNamibiaDollarTxt: Label 'Namibia Dollar'; - XNepaleseRupeeTxt: Label 'Nepalese Rupee'; - XNewIsraeliSheqelTxt: Label 'New Israeli Sheqel'; - XNewTaiwanDollarTxt: Label 'New Taiwan Dollar'; - XNgultrumTxt: Label 'Ngultrum'; - XNorthKoreanWonTxt: Label 'North Korean Won'; - XOuguiyaTxt: Label 'Ouguiya'; - XPakistanRupeeTxt: Label 'Pakistan Rupee'; - XPatacaTxt: Label 'Pataca'; - XPesoUruguayoTxt: Label 'Peso Uruguayo'; - XPlatinumTxt: Label 'Platinum'; - XPulaTxt: Label 'Pula'; - XQatariRialTxt: Label 'Qatari Rial'; - XQuetzalTxt: Label 'Quetzal'; - XRialOmaniTxt: Label 'Rial Omani'; - XRielTxt: Label 'Riel'; - XRufiyaaTxt: Label 'Rufiyaa'; - XRwandaFrancTxt: Label 'Rwanda Franc'; - XSaintHelenaPoundTxt: Label 'Saint Helena Pound'; - XSeychellesRupeeTxt: Label 'Seychelles Rupee'; - XSolTxt: Label 'Sol'; - XSomTxt: Label 'Som'; - XSomaliShillingTxt: Label 'Somali Shilling'; - XSomoniTxt: Label 'Somoni'; - XSouthSudanesePoundTxt: Label 'South Sudanese Pound'; - XSriLankaRupeeTxt: Label 'Sri Lanka Rupee'; - XSudanesePoundTxt: Label 'Sudanese Pound'; - XSurinamDollarTxt: Label 'Surinam Dollar'; - XSyrianPoundTxt: Label 'Syrian Pound'; - XTakaTxt: Label 'Taka'; - XTanzanianShillingTxt: Label 'Tanzanian Shilling'; - XTengeTxt: Label 'Tenge'; - XTrinidadAndTobagoDollarTxt: Label 'Trinidad And Tobago Dollar'; - XTugrikTxt: Label 'Tugrik'; - XTurkmenistanNewManatTxt: Label 'Turkmenistan New Manat'; - XUnidadDeFomentoTxt: Label 'Unidad De Fomento'; - XUnidadDeValorRealTxt: Label 'Unidad De Valor Real'; - XUnidadPrevisionalTxt: Label 'Unidad Previsional'; - XUzbekistanSumTxt: Label 'Uzbekistan Sum'; - XWonTxt: Label 'Won'; - XYemeniRialTxt: Label 'Yemeni Rial'; - XZambianKwachaTxt: Label 'Zambian Kwacha'; - XZimbabweGoldTxt: Label 'Zimbabwe Gold'; - NoCurrencyFoundErr: Label 'No currency was found, can not continue.'; - XNewTurkishliraTxt: Label 'New Turkish lira'; - XTonganPaangaTxt: Label 'Tongan Pa anga'; - XFrenchPacificFrancTxt: Label 'French Pacific Franc'; - - procedure InsertData(CurrencyData: Record "Temporary Currency Data") - begin - Currency.Init(); - Currency.Validate(Code, CurrencyData."Currency Code"); - Currency.Validate("ISO Code", CopyStr(Currency.Code, 1, 3)); - Currency.Validate("ISO Numeric Code", CurrencyData."ISO Numeric Code"); - Currency.Validate(Description, GetCurrencyDescription(CurrencyData."Currency Code")); - Currency.Validate("Amount Rounding Precision", CurrencyData."Amount Rounding Precision"); - Currency.Validate("Unit-Amount Rounding Precision", CurrencyData."Unit-Amount Rounding Precision"); - Currency.Validate("Invoice Rounding Precision", CurrencyData."Invoice Rounding Precision"); - Currency.Validate("Invoice Rounding Type", CurrencyData."Invoice Rounding Type"); - Currency.Validate("EMU Currency", CurrencyData."EMU Currency"); - Currency.Validate("Amount Decimal Places", CurrencyData."Amount Decimal Places"); - Currency.Validate("Unit-Amount Decimal Places", CurrencyData."Unit-Amount Decimal Places"); - Currency.Validate(Symbol, Currency.ResolveCurrencySymbol(Currency.Code)); - Currency.Insert(true); - end; - - procedure InsertExchRateData(TemporaryCurrencyData: Record "Temporary Currency Data") - begin - if Skip then - exit; - - "Create Currency Exchange Rate".InsertData( - TemporaryCurrencyData."Currency Code", CalcDate('', WorkDate()), TemporaryCurrencyData."Exchange Rate Amount", TemporaryCurrencyData."Exchange Rate Amount", - '', TemporaryCurrencyData."Relational Exch. Rate Amount", 0, TemporaryCurrencyData."Relational Exch. Rate Amount"); - end; - - procedure GetBusPostingGroup("Country Code": Code[10]): Code[10] - begin - if DemoDataSetup."Country/Region Code" = '' then - DemoDataSetup.Get(); - - case "Country Code" of - '', DemoDataSetup."Country/Region Code": - exit(DemoDataSetup.DomesticCode()); - 'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', - 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB': - exit(DemoDataSetup.EUCode()); - else - exit(DemoDataSetup.ExportCode()); - end; - end; - - procedure GetPostingGroup("Country Code": Code[10]): Code[10] - begin - if DemoDataSetup."Country/Region Code" = '' then - DemoDataSetup.Get(); - - case "Country Code" of - '', DemoDataSetup."Country/Region Code": - exit(DemoDataSetup.DomesticCode()); - 'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', - 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB': - exit(DemoDataSetup.EUCode()); - else - exit(DemoDataSetup.ForeignCode()); - end; - end; - - procedure ModifyData() - var - "G/L Account": Record "G/L Account"; - begin - DemoDataSetup.Get(); - Currency.Reset(); - if Currency.Find('-') then - repeat - if DemoDataSetup."Data Type" = DemoDataSetup."Data Type"::Extended then begin - Currency.Validate("Unrealized Gains Acc.", CA.Convert('999310')); - Currency.Validate("Unrealized Losses Acc.", CA.Convert('999320')); - Currency.Validate("Realized Gains Acc.", CA.Convert('999330')); - Currency.Validate("Realized Losses Acc.", CA.Convert('999340')); - if DemoDataSetup."Additional Currency Code" = Currency.Code then begin - Currency.Validate("Realized G/L Gains Account", CA.Convert('999330')); - Currency.Validate("Realized G/L Losses Account", CA.Convert('999340')); - Currency.Validate("Residual Gains Account", CA.Convert('999350')); - Currency.Validate("Residual Losses Account", CA.Convert('999360')); - "G/L Account".SetFilter("No.", '%1|%2|%3|%4|%5|%6|%7|%8', - CA.Convert('992310'), CA.Convert('992320'), CA.Convert('995410'), CA.Convert('995420'), - CA.Convert('999310'), CA.Convert('999320'), CA.Convert('999330'), CA.Convert('999340')); - "G/L Account".ModifyAll("Exchange Rate Adjustment", 2); - end; - end; - Currency.Modify(); - until Currency.Next() = 0; - end; - - procedure SkipDemoDataSetup(NewSkip: Boolean) - begin - Skip := NewSkip; - end; - - procedure GetCurrencyDescription(CurrencyCode: Code[10]): Text[30] - begin - DemoDataSetup.Get(); - case CurrencyCode of - 'AED': - exit(XUnitedArabEmiratesdirhamTxt); - 'AUD': - exit(XAustraliandollarTxt); - 'BGN': - exit(XBulgarianlevaTxt); - 'BND': - exit(XBruneiDarussalemdollarTxt); - 'BRL': - exit(XBrazilianrealTxt); - 'CAD': - exit(XCanadiandollarTxt); - 'CHF': - exit(XSwissfrancTxt); - 'CNY': - exit(XChineseYuanTxt); - 'CZK': - exit(XCzechkorunaTxt); - 'DKK': - exit(XDanishkroneTxt); - 'DZD': - exit(XAlgeriandinarTxt); - 'EEK': - exit(XEstoniankroonTxt); - 'EUR': - exit(XEuroTxt); - 'FJD': - exit(XFijidollarTxt); - 'GBP': - exit(XBritishpoundTxt); - 'HKD': - exit(XHongKongdollarTxt); - 'HRK': - exit(XCroatianKunaTxt); - 'HUF': - exit(XHungarianforintTxt); - 'IDR': - exit(XIndonesianrupiahTxt); - 'INR': - exit(XIndianrupeeTxt); - 'ISK': - exit(XIcelandickronaTxt); - 'JPY': - exit(XJapaneseyenTxt); - 'KES': - exit(XKenyanShillingTxt); - 'MAD': - exit(XMoroccandirhamTxt); - 'MKD': - exit(XMacedonianDenarTxt); - 'MXN': - exit(XMexicanpesoTxt); - 'MYR': - exit(XMalaysianringgitTxt); - 'MZN': - exit(XMozambiquemeticalTxt); - 'NGN': - exit(XNigeriannairaTxt); - 'NOK': - exit(XNorwegiankroneTxt); - 'NZD': - exit(XNewZealanddollarTxt); - 'PHP': - exit(XPhilippinespesoTxt); - 'PLN': - exit(XPolishzlotyTxt); - 'RON': - exit(XRomanianleuTxt); - 'RSD': - exit(XSerbianDinarTxt); - 'RUB': - exit(XRussianrubleTxt); - 'SAR': - exit(XSaudiArabianryialTxt); - 'SBD': - exit(XSolomonIslandsdollarTxt); - 'SEK': - exit(XSwedishkronaTxt); - 'SGD': - exit(XSingaporedollarTxt); - 'SIT': - exit(XSloveniantolarTxt); - 'SKK': - exit(XSlovakKorunaTxt); - 'SZL': - exit(XSwazilandlilangeniTxt); - 'THB': - exit(XThaibahtTxt); - 'TND': - exit(XTunisiandinarTxt); - 'TOP': - exit(XTonganPaangaTxt); - 'TRY': - exit(XNewTurkishliraTxt); - 'UGX': - exit(XUgandanShillingTxt); - 'USD': - exit(XUSdollarTxt); - 'VUV': - exit(XVanuatuvatuTxt); - 'WST': - exit(XWesternSamoantalaTxt); - 'XPF': - exit(XFrenchPacificFrancTxt); - 'ZAR': - exit(XSouthAfricanrandTxt); - 'AFN': - exit(XAfghaniTxt); - 'ALL': - exit(XLekTxt); - 'AMD': - exit(XArmenianDramTxt); - 'AOA': - exit(XKwanzaTxt); - 'ARS': - exit(XArgentinePesoTxt); - 'AWG': - exit(XArubanFlorinTxt); - 'AZN': - exit(XAzerbaijanManatTxt); - 'BAM': - exit(XConvertibleMarkTxt); - 'BBD': - exit(XBarbadosDollarTxt); - 'BDT': - exit(XTakaTxt); - 'BHD': - exit(XBahrainiDinarTxt); - 'BIF': - exit(XBurundiFrancTxt); - 'BMD': - exit(XBermudianDollarTxt); - 'BOB': - exit(XBolivianoTxt); - 'BOV': - exit(XMvdolTxt); - 'BSD': - exit(XBahamianDollarTxt); - 'BTN': - exit(XNgultrumTxt); - 'BWP': - exit(XPulaTxt); - 'BYN': - exit(XBelarusianRubleTxt); - 'BZD': - exit(XBelizeDollarTxt); - 'CDF': - exit(XCongoleseFrancTxt); - 'CLF': - exit(XUnidadDeFomentoTxt); - 'CLP': - exit(XChileanPesoTxt); - 'COP': - exit(XColombianPesoTxt); - 'COU': - exit(XUnidadDeValorRealTxt); - 'CRC': - exit(XCostaRicanColonTxt); - 'CUP': - exit(XCubanPesoTxt); - 'CVE': - exit(XCaboVerdeEscudoTxt); - 'DJF': - exit(XDjiboutiFrancTxt); - 'DOP': - exit(XDominicanPesoTxt); - 'EGP': - exit(XEgyptianPoundTxt); - 'ERN': - exit(XNakfaTxt); - 'ETB': - exit(XEthiopianBirrTxt); - 'FKP': - exit(XFalklandIslandsPoundTxt); - 'GEL': - exit(XLariTxt); - 'GHS': - exit(XGhanaCediTxt); - 'GIP': - exit(XGibraltarPoundTxt); - 'GMD': - exit(XDalasiTxt); - 'GNF': - exit(XGuineanFrancTxt); - 'GTQ': - exit(XQuetzalTxt); - 'GYD': - exit(XGuyanaDollarTxt); - 'HNL': - exit(XLempiraTxt); - 'HTG': - exit(XGourdeTxt); - 'ILS': - exit(XNewIsraeliSheqelTxt); - 'IQD': - exit(XIraqiDinarTxt); - 'IRR': - exit(XIranianRialTxt); - 'JMD': - exit(XJamaicanDollarTxt); - 'JOD': - exit(XJordanianDinarTxt); - 'KGS': - exit(XSomTxt); - 'KHR': - exit(XRielTxt); - 'KMF': - exit(XComorianFrancTxt); - 'KPW': - exit(XNorthKoreanWonTxt); - 'KRW': - exit(XWonTxt); - 'KWD': - exit(XKuwaitiDinarTxt); - 'KYD': - exit(XCaymanIslandsDollarTxt); - 'KZT': - exit(XTengeTxt); - 'LAK': - exit(XLaoKipTxt); - 'LBP': - exit(XLebanesePoundTxt); - 'LKR': - exit(XSriLankaRupeeTxt); - 'LRD': - exit(XLiberianDollarTxt); - 'LSL': - exit(XLotiTxt); - 'LYD': - exit(XLibyanDinarTxt); - 'MDL': - exit(XMoldovanLeuTxt); - 'MGA': - exit(XMalagasyAriaryTxt); - 'MMK': - exit(XKyatTxt); - 'MNT': - exit(XTugrikTxt); - 'MOP': - exit(XPatacaTxt); - 'MRU': - exit(XOuguiyaTxt); - 'MUR': - exit(XMauritiusRupeeTxt); - 'MVR': - exit(XRufiyaaTxt); - 'MWK': - exit(XMalawiKwachaTxt); - 'NAD': - exit(XNamibiaDollarTxt); - 'NIO': - exit(XCordobaOroTxt); - 'NPR': - exit(XNepaleseRupeeTxt); - 'OMR': - exit(XRialOmaniTxt); - 'PAB': - exit(XBalboaTxt); - 'PEN': - exit(XSolTxt); - 'PGK': - exit(XKinaTxt); - 'PKR': - exit(XPakistanRupeeTxt); - 'PYG': - exit(XGuaraniTxt); - 'QAR': - exit(XQatariRialTxt); - 'RWF': - exit(XRwandaFrancTxt); - 'SCR': - exit(XSeychellesRupeeTxt); - 'SDG': - exit(XSudanesePoundTxt); - 'SHP': - exit(XSaintHelenaPoundTxt); - 'SLE': - exit(XLeoneTxt); - 'SOS': - exit(XSomaliShillingTxt); - 'SRD': - exit(XSurinamDollarTxt); - 'SSP': - exit(XSouthSudanesePoundTxt); - 'STN': - exit(XDobraTxt); - 'SVC': - exit(XElSalvadorColonTxt); - 'SYP': - exit(XSyrianPoundTxt); - 'TJS': - exit(XSomoniTxt); - 'TMT': - exit(XTurkmenistanNewManatTxt); - 'TTD': - exit(XTrinidadAndTobagoDollarTxt); - 'TWD': - exit(XNewTaiwanDollarTxt); - 'TZS': - exit(XTanzanianShillingTxt); - 'UAH': - exit(XHryvniaTxt); - 'UYU': - exit(XPesoUruguayoTxt); - 'UYW': - exit(XUnidadPrevisionalTxt); - 'UZS': - exit(XUzbekistanSumTxt); - 'VED': - exit(XBolivarSoberanoTxt); - 'VES': - exit(XBolivarSoberanoTxt); - 'VND': - exit(XDongTxt); - 'XAF': - exit(XCentralAfricaFrancTxt); - 'XCD': - exit(XEastCaribbeanDollarTxt); - 'XCG': - exit(XCaribbeanGuilderTxt); - 'XOF': - exit(XCfaFrancBceaoTxt); - 'XPT': - exit(XPlatinumTxt); - 'YER': - exit(XYemeniRialTxt); - 'ZMW': - exit(XZambianKwachaTxt); - 'ZWG': - exit(XZimbabweGoldTxt); - '': - exit(''); - else - exit(CurrencyCode); - end; - end; - - local procedure SetLCYinGLSetup(LCYCurrencyCode: Code[10]) - var - GLSetup: Record "General Ledger Setup"; - begin - Currency.Get(LCYCurrencyCode); - GLSetup.Get(); - GLSetup."LCY Code" := ''; // to avoid error on updating LCY Code - GLSetup.Validate("LCY Code", Currency.Code); - GLSetup.Validate("Local Currency Description", GetCurrencyDescription(LCYCurrencyCode)); - GLSetup."Inv. Rounding Precision (LCY)" := Currency."Invoice Rounding Precision"; - GLSetup."Amount Rounding Precision" := Currency."Amount Rounding Precision"; - GLSetup."Unit-Amount Rounding Precision" := Currency."Unit-Amount Rounding Precision"; - GLSetup.Modify(); - end; - } - \ No newline at end of file From cc9c9b9cd62c5bec3fd429e4b8b78b1e6f8be4e0 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 7 Jul 2026 16:11:36 +0200 Subject: [PATCH 3/7] Reapply "re-added createcurrency for NL (#9135)" This reverts commit 870f61c1e9f091c5b82d2b0d15cf2ca1fa063bf4. --- .../NL/DemoTool/CreateCurrency.Codeunit.al | 656 ++++++++++++++++++ 1 file changed, 656 insertions(+) create mode 100644 src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al diff --git a/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al b/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al new file mode 100644 index 0000000000..04562bdc7e --- /dev/null +++ b/src/Layers/NL/DemoTool/CreateCurrency.Codeunit.al @@ -0,0 +1,656 @@ +codeunit 101004 "Create Currency" +{ + // // To change or update exchange rates, please change the values in the CurrencyData.txt file + // //in the pictures folder. + + TableNo = "Temporary Currency Data"; + + trigger OnRun() + begin + DemoDataSetup.Get(); + Reset(); + if FindSet() then + repeat + InsertData(Rec); + InsertExchRateData(Rec); + until Next() = 0 + else + Error(NoCurrencyFoundErr); + + if not Skip then begin + DemoDataSetup.TestField("Currency Code"); + TempCurrencyData.Get(DemoDataSetup."Currency Code"); + DemoDataSetup.Validate("Local Precision Factor", TempCurrencyData."Local Precision Factor"); + DemoDataSetup."Local Currency Factor" := + Round(TempCurrencyData."Exchange Rate Amount" / TempCurrencyData."Relational Exch. Rate Amount", 0.0001); + DemoDataSetup.Modify(); + + "Create Currency Exchange Rate".LocalizeExchangeRates(); + + SetLCYinGLSetup(DemoDataSetup."Currency Code"); + end; + end; + + var + TempCurrencyData: Record "Temporary Currency Data"; + DemoDataSetup: Record "Demo Data Setup"; + Currency: Record Currency; + CA: Codeunit "Make Adjustments"; + "Create Currency Exchange Rate": Codeunit "Create Currency Exchange Rate"; + Skip: Boolean; + XEuroTxt: Label 'Euro'; + XAustraliandollarTxt: Label 'Australian dollar'; + XBulgarianlevaTxt: Label 'Bulgarian leva'; + XBruneiDarussalemdollarTxt: Label 'Brunei Darussalam dollar'; + XBrazilianrealTxt: Label 'Brazilian real'; + XCanadiandollarTxt: Label 'Canadian dollar'; + XCroatianKunaTxt: Label 'Croatian Kuna'; + XSwissfrancTxt: Label 'Swiss franc'; + XCzechkorunaTxt: Label 'Czech koruna'; + XDanishkroneTxt: Label 'Danish krone'; + XEstoniankroonTxt: Label 'Estonian kroon'; + XFijidollarTxt: Label 'Fiji dollar'; + XBritishpoundTxt: Label 'Pound Sterling'; + XHongKongdollarTxt: Label 'Hong Kong dollar'; + XIndonesianrupiahTxt: Label 'Indonesian rupiah'; + XJapaneseyenTxt: Label 'Japanese yen'; + XIndianrupeeTxt: Label 'Indian rupee'; + XIcelandickronaTxt: Label 'Icelandic krona'; + XMalaysianringgitTxt: Label 'Malaysian ringgit'; + XMexicanpesoTxt: Label 'Mexican peso'; + XNorwegiankroneTxt: Label 'Norwegian krone'; + XNewZealanddollarTxt: Label 'New Zealand dollar'; + XPhilippinespesoTxt: Label 'Philippines peso'; + XPolishzlotyTxt: Label 'Polish zloty'; + XRussianrubleTxt: Label 'Russian ruble'; + XSwedishkronaTxt: Label 'Swedish krona'; + XSingaporedollarTxt: Label 'Singapore dollar'; + XSloveniantolarTxt: Label 'Slovenian tolar'; + XSaudiArabianryialTxt: Label 'Saudi Arabian ryial'; + XSolomonIslandsdollarTxt: Label 'Solomon Islands dollar'; + XThaibahtTxt: Label 'Thai baht'; + XUSdollarTxt: Label 'US dollar'; + XVanuatuvatuTxt: Label 'Vanuatu vatu'; + XWesternSamoantalaTxt: Label 'Western Samoan tala'; + XSouthAfricanrandTxt: Label 'South African rand'; + XUnitedArabEmiratesdirhamTxt: Label 'United Arab Emirates dirham'; + XAlgeriandinarTxt: Label 'Algerian dinar'; + XHungarianforintTxt: Label 'Hungarian forint'; + XKenyanShillingTxt: Label 'Kenyan Shilling'; + XMoroccandirhamTxt: Label 'Moroccan dirham'; + XMozambiquemeticalTxt: Label 'Mozambique metical'; + XNigeriannairaTxt: Label 'Nigerian naira'; + XRomanianleuTxt: Label 'Romanian leu'; + XSwazilandlilangeniTxt: Label 'Swaziland lilangeni'; + XSlovakKorunaTxt: Label 'Slovak Koruna'; + XSerbianDinarTxt: Label 'Serbian Dinar'; + XTunisiandinarTxt: Label 'Tunisian dinar'; + XUgandanShillingTxt: Label 'Ugandan Shilling'; + XMacedonianDenarTxt: Label 'Macedonian Denar'; + XChineseYuanTxt: Label 'Chinese Yuan'; + XAfghaniTxt: Label 'Afghani'; + XArgentinePesoTxt: Label 'Argentine Peso'; + XArmenianDramTxt: Label 'Armenian Dram'; + XArubanFlorinTxt: Label 'Aruban Florin'; + XAzerbaijanManatTxt: Label 'Azerbaijan Manat'; + XBahamianDollarTxt: Label 'Bahamian Dollar'; + XBahrainiDinarTxt: Label 'Bahraini Dinar'; + XBalboaTxt: Label 'Balboa'; + XBarbadosDollarTxt: Label 'Barbados Dollar'; + XBelarusianRubleTxt: Label 'Belarusian Ruble'; + XBelizeDollarTxt: Label 'Belize Dollar'; + XBermudianDollarTxt: Label 'Bermudian Dollar'; + XBolivarSoberanoTxt: Label 'Bolivar Soberano'; + XBolivianoTxt: Label 'Boliviano'; + XBurundiFrancTxt: Label 'Burundi Franc'; + XCaboVerdeEscudoTxt: Label 'Cabo Verde Escudo'; + XCaribbeanGuilderTxt: Label 'Caribbean Guilder'; + XCaymanIslandsDollarTxt: Label 'Cayman Islands Dollar'; + XCfaFrancBceaoTxt: Label 'Cfa Franc Bceao'; + XChileanPesoTxt: Label 'Chilean Peso'; + XColombianPesoTxt: Label 'Colombian Peso'; + XComorianFrancTxt: Label 'Comorian Franc'; + XCongoleseFrancTxt: Label 'Congolese Franc'; + XConvertibleMarkTxt: Label 'Convertible Mark'; + XCordobaOroTxt: Label 'Cordoba Oro'; + XCostaRicanColonTxt: Label 'Costa Rican Colon'; + XCubanPesoTxt: Label 'Cuban Peso'; + XDalasiTxt: Label 'Dalasi'; + XDjiboutiFrancTxt: Label 'Djibouti Franc'; + XDobraTxt: Label 'Dobra'; + XDominicanPesoTxt: Label 'Dominican Peso'; + XDongTxt: Label 'Dong'; + XCentralAfricaFrancTxt: Label 'Central African CFA Franc'; + XEastCaribbeanDollarTxt: Label 'East Caribbean Dollar'; + XEgyptianPoundTxt: Label 'Egyptian Pound'; + XElSalvadorColonTxt: Label 'El Salvador Colon'; + XEthiopianBirrTxt: Label 'Ethiopian Birr'; + XFalklandIslandsPoundTxt: Label 'Falkland Islands Pound'; + XGhanaCediTxt: Label 'Ghana Cedi'; + XGibraltarPoundTxt: Label 'Gibraltar Pound'; + XGourdeTxt: Label 'Gourde'; + XGuaraniTxt: Label 'Guarani'; + XGuineanFrancTxt: Label 'Guinean Franc'; + XGuyanaDollarTxt: Label 'Guyana Dollar'; + XHryvniaTxt: Label 'Hryvnia'; + XIranianRialTxt: Label 'Iranian Rial'; + XIraqiDinarTxt: Label 'Iraqi Dinar'; + XJamaicanDollarTxt: Label 'Jamaican Dollar'; + XJordanianDinarTxt: Label 'Jordanian Dinar'; + XKinaTxt: Label 'Kina'; + XKuwaitiDinarTxt: Label 'Kuwaiti Dinar'; + XKwanzaTxt: Label 'Kwanza'; + XKyatTxt: Label 'Kyat'; + XLaoKipTxt: Label 'Lao Kip'; + XLariTxt: Label 'Lari'; + XLebanesePoundTxt: Label 'Lebanese Pound'; + XLekTxt: Label 'Lek'; + XLempiraTxt: Label 'Lempira'; + XLeoneTxt: Label 'Leone'; + XLiberianDollarTxt: Label 'Liberian Dollar'; + XLibyanDinarTxt: Label 'Libyan Dinar'; + XLotiTxt: Label 'Loti'; + XMalagasyAriaryTxt: Label 'Malagasy Ariary'; + XMalawiKwachaTxt: Label 'Malawi Kwacha'; + XMauritiusRupeeTxt: Label 'Mauritius Rupee'; + XMoldovanLeuTxt: Label 'Moldovan Leu'; + XMvdolTxt: Label 'Mvdol'; + XNakfaTxt: Label 'Nakfa'; + XNamibiaDollarTxt: Label 'Namibia Dollar'; + XNepaleseRupeeTxt: Label 'Nepalese Rupee'; + XNewIsraeliSheqelTxt: Label 'New Israeli Sheqel'; + XNewTaiwanDollarTxt: Label 'New Taiwan Dollar'; + XNgultrumTxt: Label 'Ngultrum'; + XNorthKoreanWonTxt: Label 'North Korean Won'; + XOuguiyaTxt: Label 'Ouguiya'; + XPakistanRupeeTxt: Label 'Pakistan Rupee'; + XPatacaTxt: Label 'Pataca'; + XPesoUruguayoTxt: Label 'Peso Uruguayo'; + XPlatinumTxt: Label 'Platinum'; + XPulaTxt: Label 'Pula'; + XQatariRialTxt: Label 'Qatari Rial'; + XQuetzalTxt: Label 'Quetzal'; + XRialOmaniTxt: Label 'Rial Omani'; + XRielTxt: Label 'Riel'; + XRufiyaaTxt: Label 'Rufiyaa'; + XRwandaFrancTxt: Label 'Rwanda Franc'; + XSaintHelenaPoundTxt: Label 'Saint Helena Pound'; + XSeychellesRupeeTxt: Label 'Seychelles Rupee'; + XSolTxt: Label 'Sol'; + XSomTxt: Label 'Som'; + XSomaliShillingTxt: Label 'Somali Shilling'; + XSomoniTxt: Label 'Somoni'; + XSouthSudanesePoundTxt: Label 'South Sudanese Pound'; + XSriLankaRupeeTxt: Label 'Sri Lanka Rupee'; + XSudanesePoundTxt: Label 'Sudanese Pound'; + XSurinamDollarTxt: Label 'Surinam Dollar'; + XSyrianPoundTxt: Label 'Syrian Pound'; + XTakaTxt: Label 'Taka'; + XTanzanianShillingTxt: Label 'Tanzanian Shilling'; + XTengeTxt: Label 'Tenge'; + XTrinidadAndTobagoDollarTxt: Label 'Trinidad And Tobago Dollar'; + XTugrikTxt: Label 'Tugrik'; + XTurkmenistanNewManatTxt: Label 'Turkmenistan New Manat'; + XUnidadDeFomentoTxt: Label 'Unidad De Fomento'; + XUnidadDeValorRealTxt: Label 'Unidad De Valor Real'; + XUnidadPrevisionalTxt: Label 'Unidad Previsional'; + XUzbekistanSumTxt: Label 'Uzbekistan Sum'; + XWonTxt: Label 'Won'; + XYemeniRialTxt: Label 'Yemeni Rial'; + XZambianKwachaTxt: Label 'Zambian Kwacha'; + XZimbabweGoldTxt: Label 'Zimbabwe Gold'; + NoCurrencyFoundErr: Label 'No currency was found, can not continue.'; + XNewTurkishliraTxt: Label 'New Turkish lira'; + XTonganPaangaTxt: Label 'Tongan Pa anga'; + XFrenchPacificFrancTxt: Label 'French Pacific Franc'; + + procedure InsertData(CurrencyData: Record "Temporary Currency Data") + begin + Currency.Init(); + Currency.Validate(Code, CurrencyData."Currency Code"); + Currency.Validate("ISO Code", CopyStr(Currency.Code, 1, 3)); + Currency.Validate("ISO Numeric Code", CurrencyData."ISO Numeric Code"); + Currency.Validate(Description, GetCurrencyDescription(CurrencyData."Currency Code")); + Currency.Validate("Amount Rounding Precision", CurrencyData."Amount Rounding Precision"); + Currency.Validate("Unit-Amount Rounding Precision", CurrencyData."Unit-Amount Rounding Precision"); + Currency.Validate("Invoice Rounding Precision", CurrencyData."Invoice Rounding Precision"); + Currency.Validate("Invoice Rounding Type", CurrencyData."Invoice Rounding Type"); + Currency.Validate("EMU Currency", CurrencyData."EMU Currency"); + Currency.Validate("Amount Decimal Places", CurrencyData."Amount Decimal Places"); + Currency.Validate("Unit-Amount Decimal Places", CurrencyData."Unit-Amount Decimal Places"); + Currency.Validate(Symbol, Currency.ResolveCurrencySymbol(Currency.Code)); + Currency.Insert(true); + end; + + procedure InsertExchRateData(TemporaryCurrencyData: Record "Temporary Currency Data") + begin + if Skip then + exit; + + "Create Currency Exchange Rate".InsertData( + TemporaryCurrencyData."Currency Code", CalcDate('', WorkDate()), TemporaryCurrencyData."Exchange Rate Amount", TemporaryCurrencyData."Exchange Rate Amount", + '', TemporaryCurrencyData."Relational Exch. Rate Amount", 0, TemporaryCurrencyData."Relational Exch. Rate Amount"); + end; + + procedure GetBusPostingGroup("Country Code": Code[10]): Code[10] + begin + if DemoDataSetup."Country/Region Code" = '' then + DemoDataSetup.Get(); + + case "Country Code" of + '', DemoDataSetup."Country/Region Code": + exit(DemoDataSetup.DomesticCode()); + 'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', + 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB': + exit(DemoDataSetup.EUCode()); + else + exit(DemoDataSetup.ExportCode()); + end; + end; + + procedure GetPostingGroup("Country Code": Code[10]): Code[10] + begin + if DemoDataSetup."Country/Region Code" = '' then + DemoDataSetup.Get(); + + case "Country Code" of + '', DemoDataSetup."Country/Region Code": + exit(DemoDataSetup.DomesticCode()); + 'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', + 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB': + exit(DemoDataSetup.EUCode()); + else + exit(DemoDataSetup.ForeignCode()); + end; + end; + + procedure ModifyData() + var + "G/L Account": Record "G/L Account"; + begin + DemoDataSetup.Get(); + Currency.Reset(); + if Currency.Find('-') then + repeat + if DemoDataSetup."Data Type" = DemoDataSetup."Data Type"::Extended then begin + Currency.Validate("Unrealized Gains Acc.", CA.Convert('999310')); + Currency.Validate("Unrealized Losses Acc.", CA.Convert('999320')); + Currency.Validate("Realized Gains Acc.", CA.Convert('999330')); + Currency.Validate("Realized Losses Acc.", CA.Convert('999340')); + if DemoDataSetup."Additional Currency Code" = Currency.Code then begin + Currency.Validate("Realized G/L Gains Account", CA.Convert('999330')); + Currency.Validate("Realized G/L Losses Account", CA.Convert('999340')); + Currency.Validate("Residual Gains Account", CA.Convert('999350')); + Currency.Validate("Residual Losses Account", CA.Convert('999360')); + "G/L Account".SetFilter("No.", '%1|%2|%3|%4|%5|%6|%7|%8', + CA.Convert('992310'), CA.Convert('992320'), CA.Convert('995410'), CA.Convert('995420'), + CA.Convert('999310'), CA.Convert('999320'), CA.Convert('999330'), CA.Convert('999340')); + "G/L Account".ModifyAll("Exchange Rate Adjustment", 2); + end; + end; + Currency.Modify(); + until Currency.Next() = 0; + end; + + procedure SkipDemoDataSetup(NewSkip: Boolean) + begin + Skip := NewSkip; + end; + + procedure GetCurrencyDescription(CurrencyCode: Code[10]): Text[30] + begin + DemoDataSetup.Get(); + case CurrencyCode of + 'AED': + exit(XUnitedArabEmiratesdirhamTxt); + 'AUD': + exit(XAustraliandollarTxt); + 'BGN': + exit(XBulgarianlevaTxt); + 'BND': + exit(XBruneiDarussalemdollarTxt); + 'BRL': + exit(XBrazilianrealTxt); + 'CAD': + exit(XCanadiandollarTxt); + 'CHF': + exit(XSwissfrancTxt); + 'CNY': + exit(XChineseYuanTxt); + 'CZK': + exit(XCzechkorunaTxt); + 'DKK': + exit(XDanishkroneTxt); + 'DZD': + exit(XAlgeriandinarTxt); + 'EEK': + exit(XEstoniankroonTxt); + 'EUR': + exit(XEuroTxt); + 'FJD': + exit(XFijidollarTxt); + 'GBP': + exit(XBritishpoundTxt); + 'HKD': + exit(XHongKongdollarTxt); + 'HRK': + exit(XCroatianKunaTxt); + 'HUF': + exit(XHungarianforintTxt); + 'IDR': + exit(XIndonesianrupiahTxt); + 'INR': + exit(XIndianrupeeTxt); + 'ISK': + exit(XIcelandickronaTxt); + 'JPY': + exit(XJapaneseyenTxt); + 'KES': + exit(XKenyanShillingTxt); + 'MAD': + exit(XMoroccandirhamTxt); + 'MKD': + exit(XMacedonianDenarTxt); + 'MXN': + exit(XMexicanpesoTxt); + 'MYR': + exit(XMalaysianringgitTxt); + 'MZN': + exit(XMozambiquemeticalTxt); + 'NGN': + exit(XNigeriannairaTxt); + 'NOK': + exit(XNorwegiankroneTxt); + 'NZD': + exit(XNewZealanddollarTxt); + 'PHP': + exit(XPhilippinespesoTxt); + 'PLN': + exit(XPolishzlotyTxt); + 'RON': + exit(XRomanianleuTxt); + 'RSD': + exit(XSerbianDinarTxt); + 'RUB': + exit(XRussianrubleTxt); + 'SAR': + exit(XSaudiArabianryialTxt); + 'SBD': + exit(XSolomonIslandsdollarTxt); + 'SEK': + exit(XSwedishkronaTxt); + 'SGD': + exit(XSingaporedollarTxt); + 'SIT': + exit(XSloveniantolarTxt); + 'SKK': + exit(XSlovakKorunaTxt); + 'SZL': + exit(XSwazilandlilangeniTxt); + 'THB': + exit(XThaibahtTxt); + 'TND': + exit(XTunisiandinarTxt); + 'TOP': + exit(XTonganPaangaTxt); + 'TRY': + exit(XNewTurkishliraTxt); + 'UGX': + exit(XUgandanShillingTxt); + 'USD': + exit(XUSdollarTxt); + 'VUV': + exit(XVanuatuvatuTxt); + 'WST': + exit(XWesternSamoantalaTxt); + 'XPF': + exit(XFrenchPacificFrancTxt); + 'ZAR': + exit(XSouthAfricanrandTxt); + 'AFN': + exit(XAfghaniTxt); + 'ALL': + exit(XLekTxt); + 'AMD': + exit(XArmenianDramTxt); + 'AOA': + exit(XKwanzaTxt); + 'ARS': + exit(XArgentinePesoTxt); + 'AWG': + exit(XArubanFlorinTxt); + 'AZN': + exit(XAzerbaijanManatTxt); + 'BAM': + exit(XConvertibleMarkTxt); + 'BBD': + exit(XBarbadosDollarTxt); + 'BDT': + exit(XTakaTxt); + 'BHD': + exit(XBahrainiDinarTxt); + 'BIF': + exit(XBurundiFrancTxt); + 'BMD': + exit(XBermudianDollarTxt); + 'BOB': + exit(XBolivianoTxt); + 'BOV': + exit(XMvdolTxt); + 'BSD': + exit(XBahamianDollarTxt); + 'BTN': + exit(XNgultrumTxt); + 'BWP': + exit(XPulaTxt); + 'BYN': + exit(XBelarusianRubleTxt); + 'BZD': + exit(XBelizeDollarTxt); + 'CDF': + exit(XCongoleseFrancTxt); + 'CLF': + exit(XUnidadDeFomentoTxt); + 'CLP': + exit(XChileanPesoTxt); + 'COP': + exit(XColombianPesoTxt); + 'COU': + exit(XUnidadDeValorRealTxt); + 'CRC': + exit(XCostaRicanColonTxt); + 'CUP': + exit(XCubanPesoTxt); + 'CVE': + exit(XCaboVerdeEscudoTxt); + 'DJF': + exit(XDjiboutiFrancTxt); + 'DOP': + exit(XDominicanPesoTxt); + 'EGP': + exit(XEgyptianPoundTxt); + 'ERN': + exit(XNakfaTxt); + 'ETB': + exit(XEthiopianBirrTxt); + 'FKP': + exit(XFalklandIslandsPoundTxt); + 'GEL': + exit(XLariTxt); + 'GHS': + exit(XGhanaCediTxt); + 'GIP': + exit(XGibraltarPoundTxt); + 'GMD': + exit(XDalasiTxt); + 'GNF': + exit(XGuineanFrancTxt); + 'GTQ': + exit(XQuetzalTxt); + 'GYD': + exit(XGuyanaDollarTxt); + 'HNL': + exit(XLempiraTxt); + 'HTG': + exit(XGourdeTxt); + 'ILS': + exit(XNewIsraeliSheqelTxt); + 'IQD': + exit(XIraqiDinarTxt); + 'IRR': + exit(XIranianRialTxt); + 'JMD': + exit(XJamaicanDollarTxt); + 'JOD': + exit(XJordanianDinarTxt); + 'KGS': + exit(XSomTxt); + 'KHR': + exit(XRielTxt); + 'KMF': + exit(XComorianFrancTxt); + 'KPW': + exit(XNorthKoreanWonTxt); + 'KRW': + exit(XWonTxt); + 'KWD': + exit(XKuwaitiDinarTxt); + 'KYD': + exit(XCaymanIslandsDollarTxt); + 'KZT': + exit(XTengeTxt); + 'LAK': + exit(XLaoKipTxt); + 'LBP': + exit(XLebanesePoundTxt); + 'LKR': + exit(XSriLankaRupeeTxt); + 'LRD': + exit(XLiberianDollarTxt); + 'LSL': + exit(XLotiTxt); + 'LYD': + exit(XLibyanDinarTxt); + 'MDL': + exit(XMoldovanLeuTxt); + 'MGA': + exit(XMalagasyAriaryTxt); + 'MMK': + exit(XKyatTxt); + 'MNT': + exit(XTugrikTxt); + 'MOP': + exit(XPatacaTxt); + 'MRU': + exit(XOuguiyaTxt); + 'MUR': + exit(XMauritiusRupeeTxt); + 'MVR': + exit(XRufiyaaTxt); + 'MWK': + exit(XMalawiKwachaTxt); + 'NAD': + exit(XNamibiaDollarTxt); + 'NIO': + exit(XCordobaOroTxt); + 'NPR': + exit(XNepaleseRupeeTxt); + 'OMR': + exit(XRialOmaniTxt); + 'PAB': + exit(XBalboaTxt); + 'PEN': + exit(XSolTxt); + 'PGK': + exit(XKinaTxt); + 'PKR': + exit(XPakistanRupeeTxt); + 'PYG': + exit(XGuaraniTxt); + 'QAR': + exit(XQatariRialTxt); + 'RWF': + exit(XRwandaFrancTxt); + 'SCR': + exit(XSeychellesRupeeTxt); + 'SDG': + exit(XSudanesePoundTxt); + 'SHP': + exit(XSaintHelenaPoundTxt); + 'SLE': + exit(XLeoneTxt); + 'SOS': + exit(XSomaliShillingTxt); + 'SRD': + exit(XSurinamDollarTxt); + 'SSP': + exit(XSouthSudanesePoundTxt); + 'STN': + exit(XDobraTxt); + 'SVC': + exit(XElSalvadorColonTxt); + 'SYP': + exit(XSyrianPoundTxt); + 'TJS': + exit(XSomoniTxt); + 'TMT': + exit(XTurkmenistanNewManatTxt); + 'TTD': + exit(XTrinidadAndTobagoDollarTxt); + 'TWD': + exit(XNewTaiwanDollarTxt); + 'TZS': + exit(XTanzanianShillingTxt); + 'UAH': + exit(XHryvniaTxt); + 'UYU': + exit(XPesoUruguayoTxt); + 'UYW': + exit(XUnidadPrevisionalTxt); + 'UZS': + exit(XUzbekistanSumTxt); + 'VED': + exit(XBolivarSoberanoTxt); + 'VES': + exit(XBolivarSoberanoTxt); + 'VND': + exit(XDongTxt); + 'XAF': + exit(XCentralAfricaFrancTxt); + 'XCD': + exit(XEastCaribbeanDollarTxt); + 'XCG': + exit(XCaribbeanGuilderTxt); + 'XOF': + exit(XCfaFrancBceaoTxt); + 'XPT': + exit(XPlatinumTxt); + 'YER': + exit(XYemeniRialTxt); + 'ZMW': + exit(XZambianKwachaTxt); + 'ZWG': + exit(XZimbabweGoldTxt); + '': + exit(''); + else + exit(CurrencyCode); + end; + end; + + local procedure SetLCYinGLSetup(LCYCurrencyCode: Code[10]) + var + GLSetup: Record "General Ledger Setup"; + begin + Currency.Get(LCYCurrencyCode); + GLSetup.Get(); + GLSetup."LCY Code" := ''; // to avoid error on updating LCY Code + GLSetup.Validate("LCY Code", Currency.Code); + GLSetup.Validate("Local Currency Description", GetCurrencyDescription(LCYCurrencyCode)); + GLSetup."Inv. Rounding Precision (LCY)" := Currency."Invoice Rounding Precision"; + GLSetup."Amount Rounding Precision" := Currency."Amount Rounding Precision"; + GLSetup."Unit-Amount Rounding Precision" := Currency."Unit-Amount Rounding Precision"; + GLSetup.Modify(); + end; + } + \ No newline at end of file From f8d4008b1887a8b5d469fdc029d28148821e7da7 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 7 Jul 2026 16:23:26 +0200 Subject: [PATCH 4/7] Rename to additionalDemoDataTypes and apply globally to LegacyTestsBucket1 Rename the concept from smokeTest to additionalDemoDataTypes (setting key, function Invoke-AdditionalLegacyDemoData, throwaway company and log text). Move enablement from the NL project to a global conditionalSettings entry in .github/AL-Go-Settings.json keyed on buildMode LegacyTestsBucket1, so the additional Standard/Evaluation demo data generation runs once per country (Bucket1 only) across all countries. --- .github/AL-Go-Settings.json | 11 +++++ .../Test Apps NL/.AL-Go/settings.json | 3 +- build/scripts/ImportTestDataInBcContainer.ps1 | 46 +++++++++---------- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 84ae5f128b..31b6186a95 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -32,6 +32,17 @@ ] } }, + { + "buildModes": [ + "LegacyTestsBucket1" + ], + "settings": { + "additionalDemoDataTypes": [ + "Standard", + "Evaluation" + ] + } + }, { "projects": [ "." diff --git a/build/projects/Test Apps NL/.AL-Go/settings.json b/build/projects/Test Apps NL/.AL-Go/settings.json index 66594250aa..2cd87f6327 100644 --- a/build/projects/Test Apps NL/.AL-Go/settings.json +++ b/build/projects/Test Apps NL/.AL-Go/settings.json @@ -47,8 +47,7 @@ "settings": { "testType": "Legacy", "bucketNumber": 1, - "companyName": "CRONUS International Ltd.", - "smokeTestDemoDataTypes": [ "Standard", "Evaluation" ] + "companyName": "CRONUS International Ltd." } }, { diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 00ea2800b0..26192c5598 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -356,7 +356,7 @@ function Invoke-LegacyDemoDataTool() { <# .SYNOPSIS - Smoke-tests the legacy DemoTool for one or more non-Extended data types against a throwaway company. + Verifies the legacy DemoTool for one or more additional (non-Extended) data types against a throwaway company. .DESCRIPTION BCApps legacy tests only generate Extended demo data, so the Standard/Evaluation generation path ('Interface Trial Data'.CreateSetupData, CU122000) is never exercised in BCApps CI. Bugs on that path @@ -366,7 +366,7 @@ function Invoke-LegacyDemoDataTool() { This function closes that gap: for each requested data type it creates a disposable company, runs the legacy DemoTool into it, and removes it again. It is designed to run BEFORE the real (Extended) test company is built. Because New-TestCompany subsequently deletes all companies and recreates the real one - from a clean slate, this smoke test cannot interfere with the demo data the tests actually run against. + from a clean slate, this verification cannot interfere with the demo data the tests actually run against. The DemoTool bug class this targets throws DURING generation (before any rapidstart export), so a throwaway-company run reliably reproduces it without needing the full generate/export/delete pipeline. @@ -374,7 +374,7 @@ function Invoke-LegacyDemoDataTool() { One or more of "Standard","Evaluation". Extended is skipped here because it is already covered by the real test-company generation. #> -function Invoke-LegacyDemoDataSmokeTest() { +function Invoke-AdditionalLegacyDemoData() { param( [Parameter(Mandatory=$true)] [string]$ContainerName, @@ -387,31 +387,31 @@ function Invoke-LegacyDemoDataSmokeTest() { foreach ($demoDataType in $DemoDataTypes) { if ($demoDataType -eq "Extended") { - Write-Host "Skipping Extended in demo-data smoke test (already covered by the real test company)" + Write-Host "Skipping Extended in additional demo data verification (already covered by the real test company)" continue } - $smokeCompanyName = "Smoke $demoDataType" - Write-Host "=== Legacy DemoTool smoke test: DataType=$demoDataType (throwaway company '$smokeCompanyName') ===" + $additionalCompanyName = "Additional $demoDataType" + Write-Host "=== Legacy DemoTool additional demo data check: DataType=$demoDataType (throwaway company '$additionalCompanyName') ===" # Evaluation demo data requires an evaluation company; Standard uses a normal company. $isEvaluation = ($demoDataType -eq "Evaluation") try { - Write-Host "Creating throwaway company '$smokeCompanyName' (evaluation=$isEvaluation)" - New-CompanyInBcContainer -containerName $ContainerName -companyName $smokeCompanyName -evaluationCompany:$isEvaluation + Write-Host "Creating throwaway company '$additionalCompanyName' (evaluation=$isEvaluation)" + New-CompanyInBcContainer -containerName $ContainerName -companyName $additionalCompanyName -evaluationCompany:$isEvaluation - Invoke-LegacyDemoDataTool -ContainerName $ContainerName -CompanyName $smokeCompanyName ` + Invoke-LegacyDemoDataTool -ContainerName $ContainerName -CompanyName $additionalCompanyName ` -Credential $Credential -Tenant $Tenant -DemoDataType $demoDataType - Write-Host "Legacy DemoTool smoke test for DataType=$demoDataType succeeded" + Write-Host "Legacy DemoTool additional demo data check for DataType=$demoDataType succeeded" } catch { - throw "Legacy DemoTool smoke test FAILED for DataType=$demoDataType (country $(Get-CountryCodeFromSettings)). This path is exercised by the NAV translated-country build but not by BCApps Extended-only demo data. Error: $($_.Exception.Message)" + throw "Legacy DemoTool additional demo data check FAILED for DataType=$demoDataType (country $(Get-CountryCodeFromSettings)). This path is exercised by the NAV translated-country build but not by BCApps Extended-only demo data. Error: $($_.Exception.Message)" } finally { # Always remove the throwaway company so it never lingers into the real test run. - if (Get-CompanyInBcContainer -containerName $ContainerName | Where-Object { $_.CompanyName -eq $smokeCompanyName }) { - Write-Host "Removing throwaway company '$smokeCompanyName'" - Remove-CompanyInBcContainer -containerName $ContainerName -companyName $smokeCompanyName + if (Get-CompanyInBcContainer -containerName $ContainerName | Where-Object { $_.CompanyName -eq $additionalCompanyName }) { + Write-Host "Removing throwaway company '$additionalCompanyName'" + Remove-CompanyInBcContainer -containerName $ContainerName -companyName $additionalCompanyName } } } @@ -801,15 +801,15 @@ function Invoke-DemoDataGeneration } elseif ( $TestType -eq "Legacy" ) { Install-BaseAppsForDemoTool -ContainerName $ContainerName -CountryCode (Get-CountryCodeFromSettings) - # Optional: smoke-test non-Extended demo data (Standard/Evaluation) against throwaway companies - # BEFORE building the real Extended test company. This catches DemoTool bugs on the - # 'Interface Trial Data'.CreateSetupData path that otherwise only fail in the NAV translated-country - # build. Gated by the "smokeTestDemoDataTypes" AL-Go setting (array, e.g. ["Standard"]); when unset - # or empty, behavior is unchanged. Runs before New-TestCompany, which wipes all companies and - # recreates the real one, guaranteeing the smoke run cannot affect the demo data tests run against. - $smokeTestDemoDataTypes = Get-ALGoSetting -Key "smokeTestDemoDataTypes" - if ($smokeTestDemoDataTypes -and $smokeTestDemoDataTypes.Count -gt 0) { - Invoke-LegacyDemoDataSmokeTest -ContainerName $ContainerName -Credential $Credential -Tenant $Tenant -DemoDataTypes $smokeTestDemoDataTypes + # Optional: run the legacy DemoTool for additional non-Extended demo data types (Standard/Evaluation) + # against throwaway companies BEFORE building the real Extended test company. This catches DemoTool + # bugs on the 'Interface Trial Data'.CreateSetupData path that otherwise only fail in the NAV + # translated-country build. Gated by the "additionalDemoDataTypes" AL-Go setting (array, e.g. + # ["Standard"]); when unset or empty, behavior is unchanged. Runs before New-TestCompany, which wipes + # all companies and recreates the real one, guaranteeing this cannot affect the demo data tests run against. + $additionalDemoDataTypes = Get-ALGoSetting -Key "additionalDemoDataTypes" + if ($additionalDemoDataTypes -and $additionalDemoDataTypes.Count -gt 0) { + Invoke-AdditionalLegacyDemoData -ContainerName $ContainerName -Credential $Credential -Tenant $Tenant -DemoDataTypes $additionalDemoDataTypes } New-TestCompany -ContainerName $ContainerName -CompanyName (Get-TestCompanyName) From 7d0179b08f00d2f44901ef647b20a9d86105ecef Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 8 Jul 2026 08:55:32 +0200 Subject: [PATCH 5/7] Skip Company-Initialize (CU2) for additional demo data verification NAV's Run-NavDemoTool runs the legacy DemoTool against a fresh EMPTY company and never runs Company-Initialize (CU2). BCApps ran CU2 first, which for CZ/DK pre-seeds localization setup (via OnCompanyInitialize subscribers) that collides with the Standard/Evaluation demo data paths (duplicate CZL VAT Return Period; missing DK DOMESTIC VAT posting group). Add a -SkipCompanyInitialize switch to Invoke-LegacyDemoDataTool, passed only by the additional (Standard/Evaluation) throwaway-company verification, so it mirrors NAV for all countries. The real Extended test company keeps CU2 (unchanged). --- build/scripts/ImportTestDataInBcContainer.ps1 | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 26192c5598..74f3a4b886 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -339,13 +339,24 @@ function Invoke-LegacyDemoDataTool() { [PSCredential]$Credential, [string]$Tenant = "default", [ValidateSet("Standard","Evaluation","Extended")] - [string]$DemoDataType = "Extended" + [string]$DemoDataType = "Extended", + [switch]$SkipCompanyInitialize ) $ErrorActionPreference = "Stop" - Write-Host "Initializing company" - Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $ContainerName -CompanyName $CompanyName + # NAV's Run-NavDemoTool runs the legacy DemoTool against a brand-new EMPTY company and never runs + # Company-Initialize (CU2). For the real Extended test company we keep the CU2 call (existing behavior + # that tests may rely on), but the additional Standard/Evaluation verification passes -SkipCompanyInitialize + # to mirror NAV exactly: some localizations (e.g. CZ, DK) have OnCompanyInitialize subscribers that seed + # setup which then collides with the Standard/Evaluation demo data paths, so running CU2 first would cause + # false failures that never occur in NAV. + if (-not $SkipCompanyInitialize) { + Write-Host "Initializing company" + Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $ContainerName -CompanyName $CompanyName + } else { + Write-Host "Skipping company initialization (CU2) to mirror NAV's empty-company legacy DemoTool run" + } $countryCode = Get-CountryCodeFromSettings @@ -370,6 +381,9 @@ function Invoke-LegacyDemoDataTool() { The DemoTool bug class this targets throws DURING generation (before any rapidstart export), so a throwaway-company run reliably reproduces it without needing the full generate/export/delete pipeline. + + Company-Initialize (CU2) is deliberately skipped for these runs (see -SkipCompanyInitialize below) so the + behavior matches NAV's Run-NavDemoTool, which runs the legacy DemoTool against a fresh empty company. .PARAMETER DemoDataTypes One or more of "Standard","Evaluation". Extended is skipped here because it is already covered by the real test-company generation. @@ -402,7 +416,7 @@ function Invoke-AdditionalLegacyDemoData() { New-CompanyInBcContainer -containerName $ContainerName -companyName $additionalCompanyName -evaluationCompany:$isEvaluation Invoke-LegacyDemoDataTool -ContainerName $ContainerName -CompanyName $additionalCompanyName ` - -Credential $Credential -Tenant $Tenant -DemoDataType $demoDataType + -Credential $Credential -Tenant $Tenant -DemoDataType $demoDataType -SkipCompanyInitialize Write-Host "Legacy DemoTool additional demo data check for DataType=$demoDataType succeeded" } catch { From 2bd9429b68e079ccbfe02f1cf54b27e6fb4d3188 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 8 Jul 2026 13:29:12 +0200 Subject: [PATCH 6/7] Exclude CZ and DK from additional demo data validation for now CZ Evaluation (duplicate CZL VAT Return Period) and DK Standard (missing DOMESTIC VAT Bus. Posting Group) fail the additional demo data check in a clean container. The same shared-submodule code runs green in NAV's translated-country build, so the cause is environmental/build-config, not the check itself; skipping Company-Initialize (CU2) did not change it. Disable the check for CZ and DK only, via a project-level LegacyTestsBucket1 conditional setting. AL-Go merges (concatenates) array settings, so overwriteSettings is used to force additionalDemoDataTypes to an empty array for these two countries. All other countries still run Standard+Evaluation. Tracked for follow-up. --- build/projects/Test Apps CZ/.AL-Go/settings.json | 4 +++- build/projects/Test Apps DK/.AL-Go/settings.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/projects/Test Apps CZ/.AL-Go/settings.json b/build/projects/Test Apps CZ/.AL-Go/settings.json index f24b1e3660..f386403274 100644 --- a/build/projects/Test Apps CZ/.AL-Go/settings.json +++ b/build/projects/Test Apps CZ/.AL-Go/settings.json @@ -47,7 +47,9 @@ "settings": { "testType": "Legacy", "bucketNumber": 1, - "companyName": "CRONUS International Ltd." + "companyName": "CRONUS International Ltd.", + "overwriteSettings": [ "additionalDemoDataTypes" ], + "additionalDemoDataTypes": [] } }, { diff --git a/build/projects/Test Apps DK/.AL-Go/settings.json b/build/projects/Test Apps DK/.AL-Go/settings.json index 0de09d7a4b..0c37744a38 100644 --- a/build/projects/Test Apps DK/.AL-Go/settings.json +++ b/build/projects/Test Apps DK/.AL-Go/settings.json @@ -47,7 +47,9 @@ "settings": { "testType": "Legacy", "bucketNumber": 1, - "companyName": "CRONUS International Ltd." + "companyName": "CRONUS International Ltd.", + "overwriteSettings": [ "additionalDemoDataTypes" ], + "additionalDemoDataTypes": [] } }, { From 7a3e41bbaa17f5a85434572f7fb5aac460f596f6 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Thu, 9 Jul 2026 13:01:47 +0200 Subject: [PATCH 7/7] Prevent throwaway company cleanup from masking the diagnostic error Wrap the finally-block cleanup (Get/Remove-CompanyInBcContainer) in its own try/catch that only logs. Under ErrorActionPreference=Stop a cleanup failure in finally would otherwise replace the diagnostic error propagating from the catch block, losing the DataType/country context this check exists to surface. Addresses PR review feedback. --- build/scripts/ImportTestDataInBcContainer.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/scripts/ImportTestDataInBcContainer.ps1 b/build/scripts/ImportTestDataInBcContainer.ps1 index 74f3a4b886..4809dadcf0 100644 --- a/build/scripts/ImportTestDataInBcContainer.ps1 +++ b/build/scripts/ImportTestDataInBcContainer.ps1 @@ -423,9 +423,13 @@ function Invoke-AdditionalLegacyDemoData() { throw "Legacy DemoTool additional demo data check FAILED for DataType=$demoDataType (country $(Get-CountryCodeFromSettings)). This path is exercised by the NAV translated-country build but not by BCApps Extended-only demo data. Error: $($_.Exception.Message)" } finally { # Always remove the throwaway company so it never lingers into the real test run. - if (Get-CompanyInBcContainer -containerName $ContainerName | Where-Object { $_.CompanyName -eq $additionalCompanyName }) { - Write-Host "Removing throwaway company '$additionalCompanyName'" - Remove-CompanyInBcContainer -containerName $ContainerName -companyName $additionalCompanyName + try { + if (Get-CompanyInBcContainer -containerName $ContainerName | Where-Object { $_.CompanyName -eq $additionalCompanyName }) { + Write-Host "Removing throwaway company '$additionalCompanyName'" + Remove-CompanyInBcContainer -containerName $ContainerName -companyName $additionalCompanyName + } + } catch { + Write-Host "Warning: failed to remove throwaway company '$additionalCompanyName': $($_.Exception.Message)" } } }