From c3835e6333e785d69deeb94f0df72a4640637f58 Mon Sep 17 00:00:00 2001 From: v-shuklad Date: Tue, 25 Aug 2026 16:33:26 +0530 Subject: [PATCH 1/4] Changes --- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Tests/TestLibraries/LibrarySII.Codeunit.al | 15 ++++++++++++++- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../IT/Tests/Local/FatturaPATest.Codeunit.al | 5 +++++ .../Local/ITVATReportingExport.Codeunit.al | 16 ++++++++++++++-- .../Local/PeriodicVATPmtCommTests.Codeunit.al | 16 ++++++++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../ExportElectrAccountingTest.Codeunit.al | 17 +++++++++++------ .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- .../Misc/RSPackContentEvaluation.Codeunit.al | 11 +++++++++-- 22 files changed, 211 insertions(+), 45 deletions(-) diff --git a/src/Layers/AT/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/AT/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 14313ffc444..4b5857b2917 100644 --- a/src/Layers/AT/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/AT/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/AU/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/AU/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 18d8f5041f2..4a178a8c8ce 100644 --- a/src/Layers/AU/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/AU/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/BE/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/BE/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 0ddcd5412ab..a23e244bd6d 100644 --- a/src/Layers/BE/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/BE/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/CA/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/CA/Tests/Misc/RSPackContentEvaluation.Codeunit.al index a435dc05f0a..4ca439dad0f 100644 --- a/src/Layers/CA/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/CA/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -196,8 +196,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -213,6 +214,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure HistoricalSalesDataForAllItems() diff --git a/src/Layers/DE/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/DE/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 58905ec00ca..1a7da3f79a2 100644 --- a/src/Layers/DE/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/DE/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/DK/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/DK/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 8ff32be24d9..be174d09d18 100644 --- a/src/Layers/DK/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/DK/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/ES/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/ES/Tests/Misc/RSPackContentEvaluation.Codeunit.al index bc0b2668a1e..a049244fd97 100644 --- a/src/Layers/ES/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/ES/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/ES/Tests/TestLibraries/LibrarySII.Codeunit.al b/src/Layers/ES/Tests/TestLibraries/LibrarySII.Codeunit.al index 761f719ee8b..2afff80adf7 100644 --- a/src/Layers/ES/Tests/TestLibraries/LibrarySII.Codeunit.al +++ b/src/Layers/ES/Tests/TestLibraries/LibrarySII.Codeunit.al @@ -840,6 +840,19 @@ codeunit 143006 "Library - SII" exit(ApplicationPath + '\..\..\..\'); end; + [Scope('OnPrem')] + procedure ResolveTestAssetPath(RelativePath: Text): Text + var + FileManagement: Codeunit "File Management"; + BCAppsAssetPath: Text; + begin + // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. + BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; + if FileManagement.ServerFileExists(BCAppsAssetPath) then + exit(BCAppsAssetPath); + exit(GetInetRoot() + RelativePath); + end; + local procedure GetSignOfVATEntry(DocType: Enum "Gen. Journal Document Type"): Integer var VATEntry: Record "VAT Entry"; @@ -1067,7 +1080,7 @@ codeunit 143006 "Library - SII" XMLDoc.Save(XmlStream); XmlFile.Close(); - XsdPath := GetInetRoot() + '\GDL\ES\App\Test\SIIxmlschema\SuministroLR.xsd'; + XsdPath := ResolveTestAssetPath('\GDL\ES\App\Test\SIIxmlschema\SuministroLR.xsd'); Assert.IsTrue(LibraryVerifyXMLSchema.VerifyXMLAgainstSchema(XmlPath, XsdPath, Message), Message); end; diff --git a/src/Layers/FI/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/FI/Tests/Misc/RSPackContentEvaluation.Codeunit.al index cabc4a61e8e..d6d17d53e41 100644 --- a/src/Layers/FI/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/FI/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/GB/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/GB/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 8d2562eba1f..6696cd4e8f2 100644 --- a/src/Layers/GB/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/GB/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -148,8 +148,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -165,6 +166,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/IS/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/IS/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 4116530c682..5f6923e4c70 100644 --- a/src/Layers/IS/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/IS/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al index 5706f67c725..da69d37b436 100644 --- a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al +++ b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al @@ -63,6 +63,7 @@ codeunit 144200 "FatturaPA Test" SignatureXSDRelativePathTxt: Label '\GDL\IT\App\Test\XMLSchemas\xmldsig-core-schema.xsd', Locked = true; XSDRelativePathTxt: Label '\GDL\IT\App\Test\XMLSchemas\FatturaPA_1_2.xsd', Locked = true; InetRootRelativePathTxt: Label '..\', Locked = true; + BCAppsRelativePathTxt: Label '\App\BCApps\src', Locked = true; DescriptionTxt: Label 'Description Text'; [Test] @@ -2906,6 +2907,7 @@ codeunit 144200 "FatturaPA Test" local procedure VerifyXSDSchemaForStream(XmlInStream: InStream) VAR + FileManagement: Codeunit "File Management"; LibraryUtilityOnPrem: Codeunit "Library - Utility OnPrem"; LibraryVerifyXMLSchema: Codeunit "Library - Verify XML Schema"; Message: Text; @@ -2914,6 +2916,9 @@ codeunit 144200 "FatturaPA Test" InetRoot: Text; BEGIN InetRoot := LibraryUtilityOnPrem.GetInetRoot() + InetRootRelativePathTxt; + // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. + if FileManagement.ServerFileExists(InetRoot + BCAppsRelativePathTxt + XSDRelativePathTxt) then + InetRoot := InetRoot + BCAppsRelativePathTxt; SignatureXsdPath := InetRoot + SignatureXSDRelativePathTxt; XsdPath := InetRoot + XSDRelativePathTxt; LibraryVerifyXMLSchema.SetAdditionalSchemaPath(SignatureXsdPath); diff --git a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al index ad57b2ec294..7cd1b04c988 100644 --- a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al +++ b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al @@ -2437,6 +2437,18 @@ codeunit 144012 "IT - VAT Reporting - Export" exit(ApplicationPath + '\..\..\..\'); end; + local procedure ResolveTestAssetPath(RelativePath: Text): Text + var + FileManagement: Codeunit "File Management"; + BCAppsAssetPath: Text; + begin + // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. + BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; + if FileManagement.ServerFileExists(BCAppsAssetPath) then + exit(BCAppsAssetPath); + exit(GetInetRoot() + RelativePath); + end; + local procedure GenerateReportLine(var VATReportHeader: Record "VAT Report Header"; var VATReportLine: Record "VAT Report Line"; IndividualPerson: Boolean; Resident: Option; DocumentType: Enum "Gen. Journal Document Type"; GenPostingType: Enum "General Posting Type"; VATReportType: Option; ContractPaymentType: Option) var VATPostingSetup: Record "VAT Posting Setup"; @@ -2508,9 +2520,9 @@ codeunit 144012 "IT - VAT Reporting - Export" XMLDoc.Save(XmlStream); XmlFile.Close(); - SignatureXsdPath := GetInetRoot() + '\GDL\IT\App\Test\XMLSchemas\xmldsig-core-schema.xsd'; + SignatureXsdPath := ResolveTestAssetPath('\GDL\IT\App\Test\XMLSchemas\xmldsig-core-schema.xsd'); LibraryVerifyXMLSchema.SetAdditionalSchemaPath(SignatureXsdPath); - XsdPath := GetInetRoot() + '\GDL\IT\App\Test\XMLSchemas\fornituraIvp_2018_v1.xsd'; + XsdPath := ResolveTestAssetPath('\GDL\IT\App\Test\XMLSchemas\fornituraIvp_2018_v1.xsd'); Assert.IsTrue(LibraryVerifyXMLSchema.VerifyXMLAgainstSchema(XmlPath, XsdPath, Message), Message); end; diff --git a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al index 0e3f9beb2f3..596eb37b309 100644 --- a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al +++ b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al @@ -251,9 +251,9 @@ codeunit 144150 "Periodic VAT Pmt. Comm. Tests" VATPaymentCommunication.Run(); // [THEN] XML generated conforms to the XSD - SignatureSchemaPath := GetInetRoot() + '\GDL\IT\App\Test\XMLSchemas\xmldsig-core-schema.xsd'; + SignatureSchemaPath := ResolveTestAssetPath('\GDL\IT\App\Test\XMLSchemas\xmldsig-core-schema.xsd'); LibraryVerifyXMLSchema.SetAdditionalSchemaPath(SignatureSchemaPath); - SchemaPath := GetInetRoot() + '\GDL\IT\App\Test\XMLSchemas\fornituraIvp_2018_v1.xsd'; + SchemaPath := ResolveTestAssetPath('\GDL\IT\App\Test\XMLSchemas\fornituraIvp_2018_v1.xsd'); Assert.IsTrue(LibraryVerifyXMLSchema.VerifyXMLAgainstSchema(DestinationPath, SchemaPath, Message), Message); UnbindSubscription(PeriodicVATPmtCommTests); end; @@ -1202,6 +1202,18 @@ codeunit 144150 "Periodic VAT Pmt. Comm. Tests" exit(ApplicationPath + '\..\..\..\'); end; + local procedure ResolveTestAssetPath(RelativePath: Text): Text + var + FileManagement: Codeunit "File Management"; + BCAppsAssetPath: Text; + begin + // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. + BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; + if FileManagement.ServerFileExists(BCAppsAssetPath) then + exit(BCAppsAssetPath); + exit(GetInetRoot() + RelativePath); + end; + local procedure PopulateVATEntryTable(StartDate: Date; var TotalSales: Decimal; var TotalPurchases: Decimal; var TotalSalesTax: Decimal; var TotalPurchaseTax: Decimal) var VATEntry: Record "VAT Entry"; diff --git a/src/Layers/IT/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/IT/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 8af2398d627..7ba9c2e3fc3 100644 --- a/src/Layers/IT/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/IT/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/MX/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/MX/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 08add500c3c..599d5c7465a 100644 --- a/src/Layers/MX/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/MX/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al b/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al index 7e1e9ab1a96..a2002c6511d 100644 --- a/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al +++ b/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al @@ -1180,13 +1180,18 @@ local procedure ExportXSDShemas() var LibraryUtilityOnPrem: Codeunit "Library - Utility OnPrem"; + FileManagement: Codeunit "File Management"; + SchemaRoot: Text; begin - XSDSchemaFile_CatalogosParaEsqContE := - LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\CatalogosParaEsqContE.xsd'; - XSDSchemaFile_ChartOfAccount := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\CatalogoCuentas_1_3.xsd'; - XSDSchemaFile_Balance := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\BalanzaComprobacion_1_3.xsd'; - XSDSchemaFile_Transactions := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\PolizasPeriodo_1_3.xsd'; - XSDSchemaFile_AuxAccount := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\AuxiliarCtas_1_3.xsd'; + SchemaRoot := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\'; + // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. + if FileManagement.ServerFileExists(LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\App\BCApps\src\GDL\NA\App\Test\XMLSchemas\CatalogoCuentas_1_3.xsd') then + SchemaRoot := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\App\BCApps\src\GDL\NA\App\Test\XMLSchemas\'; + XSDSchemaFile_CatalogosParaEsqContE := SchemaRoot + 'CatalogosParaEsqContE.xsd'; + XSDSchemaFile_ChartOfAccount := SchemaRoot + 'CatalogoCuentas_1_3.xsd'; + XSDSchemaFile_Balance := SchemaRoot + 'BalanzaComprobacion_1_3.xsd'; + XSDSchemaFile_Transactions := SchemaRoot + 'PolizasPeriodo_1_3.xsd'; + XSDSchemaFile_AuxAccount := SchemaRoot + 'AuxiliarCtas_1_3.xsd'; end; } diff --git a/src/Layers/NO/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/NO/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 816d679c6eb..cc5e7c88a1f 100644 --- a/src/Layers/NO/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/NO/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/NZ/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/NZ/Tests/Misc/RSPackContentEvaluation.Codeunit.al index d052d466ef1..097b7e71d1d 100644 --- a/src/Layers/NZ/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/NZ/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/SE/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/SE/Tests/Misc/RSPackContentEvaluation.Codeunit.al index a316de82563..b22030da73a 100644 --- a/src/Layers/SE/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/SE/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/US/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/US/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 3213dc453c8..31924d29b23 100644 --- a/src/Layers/US/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/US/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -196,8 +196,9 @@ // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -213,6 +214,12 @@ until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() diff --git a/src/Layers/W1/Tests/Misc/RSPackContentEvaluation.Codeunit.al b/src/Layers/W1/Tests/Misc/RSPackContentEvaluation.Codeunit.al index 1e859061f96..63937e097aa 100644 --- a/src/Layers/W1/Tests/Misc/RSPackContentEvaluation.Codeunit.al +++ b/src/Layers/W1/Tests/Misc/RSPackContentEvaluation.Codeunit.al @@ -149,8 +149,9 @@ codeunit 138400 "RS Pack Content - Evaluation" // [SCENARIO] The data on itemsales.xml are consistent Initialize(); - TempXMLBuffer.Load(FileManagement.CombinePath( - ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); + // Demo data moved under App\BCApps\src during the submodule migration; try the new location, fall back to the legacy layout. + if not TryLoadXmlBuffer(TempXMLBuffer, FileManagement.CombinePath(ApplicationPath, '../../App/BCApps/src/DemoTool/Pictures/MachineLearning/itemsales.xml')) then + TempXMLBuffer.Load(FileManagement.CombinePath(ApplicationPath, '../../App/Demotool/Pictures/MachineLearning/itemsales.xml')); Item.SetRange("Assembly BOM", false); Evaluate(Periods, TempXMLBuffer.GetAttributeValueAsText('Periods')); @@ -166,6 +167,12 @@ codeunit 138400 "RS Pack Content - Evaluation" until TempXMLBuffer.Next() = 0; end; + [TryFunction] + local procedure TryLoadXmlBuffer(var TempXMLBuffer: Record "XML Buffer" temporary; FilePath: Text) + begin + TempXMLBuffer.Load(FilePath); + end; + [Test] [Scope('OnPrem')] procedure AnyCustomerHaveSalespersonCode() From d70f994946ddf581c242e385d716da9ddcaa0df5 Mon Sep 17 00:00:00 2001 From: v-shuklad Date: Wed, 26 Aug 2026 13:41:32 +0530 Subject: [PATCH 2/4] Changes --- src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al | 2 -- src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al | 1 - src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al | 2 -- .../NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al | 2 -- 4 files changed, 7 deletions(-) diff --git a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al index da69d37b436..818ce18a906 100644 --- a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al +++ b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al @@ -2907,7 +2907,6 @@ codeunit 144200 "FatturaPA Test" local procedure VerifyXSDSchemaForStream(XmlInStream: InStream) VAR - FileManagement: Codeunit "File Management"; LibraryUtilityOnPrem: Codeunit "Library - Utility OnPrem"; LibraryVerifyXMLSchema: Codeunit "Library - Verify XML Schema"; Message: Text; @@ -2916,7 +2915,6 @@ codeunit 144200 "FatturaPA Test" InetRoot: Text; BEGIN InetRoot := LibraryUtilityOnPrem.GetInetRoot() + InetRootRelativePathTxt; - // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. if FileManagement.ServerFileExists(InetRoot + BCAppsRelativePathTxt + XSDRelativePathTxt) then InetRoot := InetRoot + BCAppsRelativePathTxt; SignatureXsdPath := InetRoot + SignatureXSDRelativePathTxt; diff --git a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al index 7cd1b04c988..980bbb703bc 100644 --- a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al +++ b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al @@ -2442,7 +2442,6 @@ codeunit 144012 "IT - VAT Reporting - Export" FileManagement: Codeunit "File Management"; BCAppsAssetPath: Text; begin - // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; if FileManagement.ServerFileExists(BCAppsAssetPath) then exit(BCAppsAssetPath); diff --git a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al index 596eb37b309..aad4202cf26 100644 --- a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al +++ b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al @@ -1204,10 +1204,8 @@ codeunit 144150 "Periodic VAT Pmt. Comm. Tests" local procedure ResolveTestAssetPath(RelativePath: Text): Text var - FileManagement: Codeunit "File Management"; BCAppsAssetPath: Text; begin - // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; if FileManagement.ServerFileExists(BCAppsAssetPath) then exit(BCAppsAssetPath); diff --git a/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al b/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al index a2002c6511d..ddf80142860 100644 --- a/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al +++ b/src/Layers/NA/Tests/Local/ExportElectrAccountingTest.Codeunit.al @@ -1180,11 +1180,9 @@ local procedure ExportXSDShemas() var LibraryUtilityOnPrem: Codeunit "Library - Utility OnPrem"; - FileManagement: Codeunit "File Management"; SchemaRoot: Text; begin SchemaRoot := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\GDL\NA\App\Test\XMLSchemas\'; - // Test assets moved under App\BCApps\src during the submodule migration; probe there first, fall back to the legacy layout. if FileManagement.ServerFileExists(LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\App\BCApps\src\GDL\NA\App\Test\XMLSchemas\CatalogoCuentas_1_3.xsd') then SchemaRoot := LibraryUtilityOnPrem.GetInetRoot() + '..\' + '\App\BCApps\src\GDL\NA\App\Test\XMLSchemas\'; XSDSchemaFile_CatalogosParaEsqContE := SchemaRoot + 'CatalogosParaEsqContE.xsd'; From 9dfeabca7cac25d40fecf6a9a87f62efbf471acd Mon Sep 17 00:00:00 2001 From: v-shuklad Date: Mon, 7 Sep 2026 16:51:19 +0530 Subject: [PATCH 3/4] Changes --- .../Reporting/DatifatturaExport.Codeunit.al | 3 +- .../Local/ITVATReportingExport.Codeunit.al | 75 ++++++++++++++----- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/src/Layers/IT/BaseApp/Local/Finance/VAT/Reporting/DatifatturaExport.Codeunit.al b/src/Layers/IT/BaseApp/Local/Finance/VAT/Reporting/DatifatturaExport.Codeunit.al index 87339dba3e3..b81874a31e5 100644 --- a/src/Layers/IT/BaseApp/Local/Finance/VAT/Reporting/DatifatturaExport.Codeunit.al +++ b/src/Layers/IT/BaseApp/Local/Finance/VAT/Reporting/DatifatturaExport.Codeunit.al @@ -108,7 +108,8 @@ codeunit 12182 "Datifattura Export" if FileNameCounter = 0 then exit; - TempNameValueBuffer.FindSet(); + if not TempNameValueBuffer.FindSet() then + exit; if FileNameCounter > 1 then begin DataCompression.CreateZipArchive(); repeat diff --git a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al index 980bbb703bc..422c722592d 100644 --- a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al +++ b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al @@ -2626,27 +2626,61 @@ codeunit 144012 "IT - VAT Reporting - Export" local procedure VerifyDatiFatturaAttributes(FileName: Text) var - XMLDoc: DotNet XmlDocument; + XmlDocument: XmlDocument; + XmlRootElement: XmlElement; begin - XMLDoc := XMLDoc.XmlDocument(); - XMLDoc.Load(FileName); - ValidateXmlAgainstXsdSchema(XMLDoc); - LibraryXMLRead.Initialize(FileName); - LibraryXMLRead.VerifyAttributeValue('ns2:DatiFattura', 'xmlns:xs', StandardDatifatturaXmlnsXsAttrTxt); - LibraryXMLRead.VerifyAttributeValue('ns2:DatiFattura', 'xmlns:ds', StandardDatifatturaXmlnsDsAttrTxt); - LibraryXMLRead.VerifyAttributeValue('ns2:DatiFattura', 'versione', 'DAT20'); - LibraryXMLRead.VerifyAttributeValue('ns2:DatiFattura', 'xmlns:ns2', StandardDatifatturaXmlnsNs2AttrTxt); + LoadXmlDocument(FileName, XmlDocument); + XmlDocument.GetRoot(XmlRootElement); + VerifyXmlAttribute(XmlRootElement, 'xs', 'http://www.w3.org/2000/xmlns/', StandardDatifatturaXmlnsXsAttrTxt); + VerifyXmlAttribute(XmlRootElement, 'ds', 'http://www.w3.org/2000/xmlns/', StandardDatifatturaXmlnsDsAttrTxt); + VerifyXmlAttribute(XmlRootElement, 'versione', '', 'DAT20'); + VerifyXmlAttribute(XmlRootElement, 'ns2', 'http://www.w3.org/2000/xmlns/', StandardDatifatturaXmlnsNs2AttrTxt); end; local procedure VerifyDatiFatturaInvoiceNoAndDate(FileName: Text; PostingDate: Date; Numero: Text) + var + XmlDocument: XmlDocument; + ActualNumero: Text; begin - LibraryXMLRead.Initialize(FileName); - Assert.AreEqual(1, LibraryXMLRead.GetNodesCount('Numero'), 'Incorrect Numero count'); - Assert.AreEqual(GetAlphanumeric(Numero), LibraryXMLRead.GetNodeValueAtIndex('Numero', 0), 'Incorrect Numero value'); - AssertIsAlphanumeric(LibraryXMLRead.GetNodeValueAtIndex('Numero', 0)); - Assert.AreEqual(1, LibraryXMLRead.GetNodesCount('Data'), 'Incorrect Data count'); + LoadXmlDocument(FileName, XmlDocument); + ActualNumero := GetSingleXmlNodeValue(XmlDocument, 'Numero'); + Assert.AreEqual(GetAlphanumeric(Numero), ActualNumero, 'Incorrect Numero value'); + AssertIsAlphanumeric(ActualNumero); Assert.AreEqual( - Format(PostingDate, 0, '--'), LibraryXMLRead.GetNodeValueAtIndex('Data', 0), 'Incorrect Data value'); + Format(PostingDate, 0, '--'), GetSingleXmlNodeValue(XmlDocument, 'Data'), 'Incorrect Data value'); + end; + + local procedure LoadXmlDocument(FileName: Text; var LoadedXmlDocument: XmlDocument) + var + XmlFile: File; + XmlInStream: InStream; + begin + XmlFile.Open(FileName); + XmlFile.CreateInStream(XmlInStream); + XmlDocument.ReadFrom(XmlInStream, LoadedXmlDocument); + XmlFile.Close(); + end; + + local procedure GetSingleXmlNodeValue(XmlDocument: XmlDocument; NodeName: Text): Text + var + XmlNode: XmlNode; + XmlNodeList: XmlNodeList; + begin + XmlDocument.SelectNodes(StrSubstNo('//*[local-name()="%1"]', NodeName), XmlNodeList); + Assert.AreEqual(1, XmlNodeList.Count(), StrSubstNo('Incorrect %1 count', NodeName)); + XmlNodeList.Get(1, XmlNode); + exit(XmlNode.AsXmlElement().InnerText()); + end; + + local procedure VerifyXmlAttribute(XmlElement: XmlElement; AttributeName: Text; NamespaceUri: Text; ExpectedValue: Text) + var + XmlAttribute: XmlAttribute; + XmlAttributes: XmlAttributeCollection; + begin + XmlAttributes := XmlElement.Attributes(); + Assert.IsTrue( + XmlAttributes.Get(AttributeName, NamespaceUri, XmlAttribute), StrSubstNo('Attribute %1 is missing', AttributeName)); + Assert.AreEqual(ExpectedValue, XmlAttribute.Value(), StrSubstNo('Incorrect %1 attribute value', AttributeName)); end; local procedure VerifyDatiFatturaFileForScenarioWithOneFile(NodeName: Text; SuggestedFileName: Text) @@ -3884,11 +3918,14 @@ codeunit 144012 "IT - VAT Reporting - Export" local procedure VerifyDetraibileAndDeducibileNonExistInXmlFile(FileName: Text) var - LibraryXPathXMLReader: Codeunit "Library - XPath XML Reader"; + XmlDocument: XmlDocument; + XmlNodeList: XmlNodeList; begin - LibraryXPathXMLReader.Initialize(FileName, 'ns2:DatiFattura'); - LibraryXPathXMLReader.VerifyNodeCountByXPath('/DTE/CessionarioCommittenteDTE/DatiFatturaBodyDTE/DatiRiepilogo/Detraibile', 0); - LibraryXPathXMLReader.VerifyNodeCountByXPath('/DTE/CessionarioCommittenteDTE/DatiFatturaBodyDTE/DatiRiepilogo/Deducibile', 0); + LoadXmlDocument(FileName, XmlDocument); + XmlDocument.SelectNodes('//*[local-name()="Detraibile"]', XmlNodeList); + Assert.AreEqual(0, XmlNodeList.Count(), 'Incorrect Detraibile count'); + XmlDocument.SelectNodes('//*[local-name()="Deducibile"]', XmlNodeList); + Assert.AreEqual(0, XmlNodeList.Count(), 'Incorrect Deducibile count'); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Datifattura Export", 'OnBeforeSaveFileOnClient', '', false, false)] From 90364e9f01e19c2d444cb1c421f6d49093c1bf9e Mon Sep 17 00:00:00 2001 From: v-shuklad Date: Tue, 8 Sep 2026 11:24:34 +0530 Subject: [PATCH 4/4] Changes --- .../IT/Tests/Local/FatturaPATest.Codeunit.al | 4 +--- .../Local/ITVATReportingExport.Codeunit.al | 21 ++++++++++++------- .../Local/PeriodicVATPmtCommTests.Codeunit.al | 8 ++----- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al index 818ce18a906..cec2d90539b 100644 --- a/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al +++ b/src/Layers/IT/Tests/Local/FatturaPATest.Codeunit.al @@ -2914,9 +2914,7 @@ codeunit 144200 "FatturaPA Test" XsdPath: Text; InetRoot: Text; BEGIN - InetRoot := LibraryUtilityOnPrem.GetInetRoot() + InetRootRelativePathTxt; - if FileManagement.ServerFileExists(InetRoot + BCAppsRelativePathTxt + XSDRelativePathTxt) then - InetRoot := InetRoot + BCAppsRelativePathTxt; + InetRoot := LibraryUtilityOnPrem.GetInetRoot() + InetRootRelativePathTxt + BCAppsRelativePathTxt; SignatureXsdPath := InetRoot + SignatureXSDRelativePathTxt; XsdPath := InetRoot + XSDRelativePathTxt; LibraryVerifyXMLSchema.SetAdditionalSchemaPath(SignatureXsdPath); diff --git a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al index 422c722592d..89d66dea8b1 100644 --- a/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al +++ b/src/Layers/IT/Tests/Local/ITVATReportingExport.Codeunit.al @@ -41,6 +41,10 @@ codeunit 144012 "IT - VAT Reporting - Export" StandardDatifatturaXmlnsDsAttrTxt: Label 'http://www.w3.org/2000/09/xmldsig#', Locked = true; StandardDatifatturaXmlnsNs2AttrTxt: Label 'http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v2.0', Locked = true; DatiFatturaForOneDocumentWithMultipleLinesErr: Label 'DatiFattura Report has wrong number of elements for document with multiple lines.'; + XPathQueryLbl: Label '//*[local-name()="%1"]', Locked = true, Comment = '%1 = element name used to build an XPath expression'; + IncorrectNodeCountErr: Label 'Incorrect %1 count', Comment = '%1 = node name'; + AttributeMissingErr: Label 'Attribute %1 is missing', Comment = '%1 = attribute name'; + IncorrectAttributeValueErr: Label 'Incorrect %1 attribute value', Comment = '%1 = attribute name'; [Test] [HandlerFunctions('MessageHandler')] @@ -2666,10 +2670,10 @@ codeunit 144012 "IT - VAT Reporting - Export" XmlNode: XmlNode; XmlNodeList: XmlNodeList; begin - XmlDocument.SelectNodes(StrSubstNo('//*[local-name()="%1"]', NodeName), XmlNodeList); - Assert.AreEqual(1, XmlNodeList.Count(), StrSubstNo('Incorrect %1 count', NodeName)); - XmlNodeList.Get(1, XmlNode); - exit(XmlNode.AsXmlElement().InnerText()); + XmlDocument.SelectNodes(StrSubstNo(XPathQueryLbl, NodeName), XmlNodeList); + Assert.AreEqual(1, XmlNodeList.Count(), StrSubstNo(IncorrectNodeCountErr, NodeName)); + XmlNodeList.Get(1, XmlNode); + exit(XmlNode.AsXmlElement().InnerText()); end; local procedure VerifyXmlAttribute(XmlElement: XmlElement; AttributeName: Text; NamespaceUri: Text; ExpectedValue: Text) @@ -2677,10 +2681,11 @@ codeunit 144012 "IT - VAT Reporting - Export" XmlAttribute: XmlAttribute; XmlAttributes: XmlAttributeCollection; begin - XmlAttributes := XmlElement.Attributes(); - Assert.IsTrue( - XmlAttributes.Get(AttributeName, NamespaceUri, XmlAttribute), StrSubstNo('Attribute %1 is missing', AttributeName)); - Assert.AreEqual(ExpectedValue, XmlAttribute.Value(), StrSubstNo('Incorrect %1 attribute value', AttributeName)); + XmlAttributes := XmlElement.Attributes(); + Assert.IsTrue( + XmlAttributes.Get(AttributeName, NamespaceUri, XmlAttribute), StrSubstNo(AttributeMissingErr, AttributeName)); + Assert.AreEqual(ExpectedValue, XmlAttribute.Value(), StrSubstNo(IncorrectAttributeValueErr, AttributeName)); + end; local procedure VerifyDatiFatturaFileForScenarioWithOneFile(NodeName: Text; SuggestedFileName: Text) diff --git a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al index aad4202cf26..26b061bea81 100644 --- a/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al +++ b/src/Layers/IT/Tests/Local/PeriodicVATPmtCommTests.Codeunit.al @@ -30,6 +30,7 @@ codeunit 144150 "Periodic VAT Pmt. Comm. Tests" SpecifyMethodOfCalcAdvancedAmountErr: Label 'You must select a calculation method for advanced amounts.'; ModuleNumberBlankErr: Label 'You must enter a module number.'; WrongCaptionErr: Label 'Wrong caption.'; + BCAppsRelativePathTxt: Label '\App\BCApps\src', Locked = true; [Test] [Scope('OnPrem')] @@ -1203,13 +1204,8 @@ codeunit 144150 "Periodic VAT Pmt. Comm. Tests" end; local procedure ResolveTestAssetPath(RelativePath: Text): Text - var - BCAppsAssetPath: Text; begin - BCAppsAssetPath := GetInetRoot() + '\App\BCApps\src' + RelativePath; - if FileManagement.ServerFileExists(BCAppsAssetPath) then - exit(BCAppsAssetPath); - exit(GetInetRoot() + RelativePath); + exit(GetInetRoot() + BCAppsRelativePathTxt + RelativePath); end; local procedure PopulateVATEntryTable(StartDate: Date; var TotalSales: Decimal; var TotalPurchases: Decimal; var TotalSalesTax: Decimal; var TotalPurchaseTax: Decimal)