diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 365d060b82..b5e16fd7bb 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -5,7 +5,7 @@ "runs-on": "windows-latest", "cacheImageName": "", "UsePsSession": false, - "artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/26.0.25961.0/base", + "artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/26.0.26183.0/base", "country": "base", "useProjectDependencies": true, "repoVersion": "26.0", diff --git a/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/CalcNormalDeprHandlerCZF.Codeunit.al b/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/CalcNormalDeprHandlerCZF.Codeunit.al index 734351678b..3116d92347 100644 --- a/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/CalcNormalDeprHandlerCZF.Codeunit.al +++ b/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/CalcNormalDeprHandlerCZF.Codeunit.al @@ -353,7 +353,7 @@ codeunit 31247 "Calc. Normal Depr. Handler CZF" #endregion Use FA Ledger Check [EventSubscriber(ObjectType::Codeunit, Codeunit::"Depreciation Calculation", 'OnBeforeCalcRounding', '', false, false)] - local procedure RoundUpOnBeforeCalcRounding(DeprBook: Record "Depreciation Book"; var DeprAmount: Decimal; var IsHandled: Boolean) + local procedure RoundUpOnBeforeCalcRounding(DeprBook: Record "Depreciation Book"; OrigDeprAmount: Decimal; var DeprAmount: Decimal; var IsHandled: Boolean) begin if DeprBook."Use Rounding in Periodic Depr." then begin DeprAmount := Round(DeprAmount, 1, '>'); diff --git a/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/FADisposalHandlerCZF.Codeunit.al b/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/FADisposalHandlerCZF.Codeunit.al index 2145bc32e3..f61769fbcb 100644 --- a/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/FADisposalHandlerCZF.Codeunit.al +++ b/Apps/CZ/FixedAssetLocalization/app/Src/Codeunits/FADisposalHandlerCZF.Codeunit.al @@ -289,7 +289,7 @@ codeunit 31235 "FA Disposal Handler CZF" CalculateDisposal.CalcGainLoss(FANo, DeprBookCode, EntryAmounts); for i := 1 to 14 do if EntryAmounts[i] <> 0 then begin - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(i); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i); FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i)); FALedgEntry.Amount := EntryAmounts[i]; if i = 1 then @@ -324,12 +324,12 @@ codeunit 31235 "FA Disposal Handler CZF" 10: FAPostingType := FAPostingType::BookVal; end; - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(4); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(4); FALedgEntry."FA Posting Type" := CalculateDisposal.SetFAPostingType(4); FALedgEntry.Amount := -EntryAmounts[i]; FAInsertLedgEntry.InsertFA(FALedgEntry); if i in [3, 5, 6, 10] then begin - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(i); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i); FALedgEntry."FA Posting Type" := CalculateDisposal.SetFAPostingType(i); FALedgEntry.Amount := EntryAmounts[i]; end; @@ -345,7 +345,7 @@ codeunit 31235 "FA Disposal Handler CZF" CalculateDisposal.CalcSecondGainLoss(FANo, DeprBookCode, FALedgEntry.Amount, EntryAmounts); for i := 1 to 2 do if EntryAmounts[i] <> 0 then begin - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(i); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i); FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i)); FALedgEntry.Amount := EntryAmounts[i]; if i = 1 then @@ -372,7 +372,7 @@ codeunit 31235 "FA Disposal Handler CZF" if EntryNumbers[i] <> 0 then begin FALedgEntry.Amount := EntryAmounts[i]; FALedgEntry."Entry No." := EntryNumbers[i]; - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(i); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i); FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i)); if i = 1 then FALedgEntry."Result on Disposal" := FALedgEntry."Result on Disposal"::Gain; @@ -406,13 +406,13 @@ codeunit 31235 "FA Disposal Handler CZF" 10: FAPostingType := FAPostingType::BookVal; end; - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(4); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(4); FALedgEntry."FA Posting Type" := CalculateDisposal.SetFAPostingType(4); FALedgEntry.Amount := -EntryAmounts[i]; FALedgEntry."Entry No." := EntryNumbers[i] + 1; FAInsertLedgEntry.InsertFA(FALedgEntry); if i in [3, 5, 6, 10] then begin - FALedgEntry."FA Posting Category" := CalculateDisposal.SetFAPostingCategory(i); + FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i); FALedgEntry."FA Posting Type" := CalculateDisposal.SetFAPostingType(i); FALedgEntry.Amount := EntryAmounts[i]; end; diff --git a/Apps/IN/INGST/app/GSTBase/src/TaxEngineSetup/GSTTaxConfiguration.Codeunit.al b/Apps/IN/INGST/app/GSTBase/src/TaxEngineSetup/GSTTaxConfiguration.Codeunit.al index ad940653f8..d7a192be02 100644 --- a/Apps/IN/INGST/app/GSTBase/src/TaxEngineSetup/GSTTaxConfiguration.Codeunit.al +++ b/Apps/IN/INGST/app/GSTBase/src/TaxEngineSetup/GSTTaxConfiguration.Codeunit.al @@ -62,7 +62,7 @@ codeunit 18017 "GST Tax Configuration" UseCases.Add('{AFA9BC82-6757-44E3-B5E4-00029DACDA64}', 4); UseCases.Add('{8EECE1FD-4BDB-4A37-92ED-00380C170CFC}', 3); UseCases.Add('{38583B1E-682C-4B06-BB69-005849014E82}', 1); - UseCases.Add('{46054EB7-3CE7-421C-B047-00658AC5C150}', 2); + UseCases.Add('{46054EB7-3CE7-421C-B047-00658AC5C150}', 3); UseCases.Add('{D2457D2F-2B0E-4F56-BF93-007E245C4FF8}', 1); UseCases.Add('{E9E7486C-DBFB-432C-886F-017AD828CE5E}', 6); UseCases.Add('{6D031AA1-2009-4D4A-A8E7-01D9116EDC5C}', 3); @@ -77,7 +77,7 @@ codeunit 18017 "GST Tax Configuration" UseCases.Add('{BBD37D0A-E328-4544-B5E1-03FCF65399D5}', 6); UseCases.Add('{1C2FBFBD-A18B-4A5D-819E-043993E5510C}', 6); UseCases.Add('{4684DF92-D578-4978-B4EC-04ACC07C8206}', 4); - UseCases.Add('{668C2032-DD90-4A23-8F30-04B69FE7C99E}', 2); + UseCases.Add('{668C2032-DD90-4A23-8F30-04B69FE7C99E}', 3); UseCases.Add('{C89845E0-C8B1-45B1-9C1B-04EC264B7AC7}', 5); UseCases.Add('{76F9EC4B-C6F3-4DBE-B1CA-04EFC5AD609E}', 5); UseCases.Add('{4AC1A712-CC9B-4CB7-91EA-05245C1D7211}', 4); diff --git a/Apps/IN/INGST/app/Translations/India GST.en-GB.xlf b/Apps/IN/INGST/app/Translations/India GST.en-GB.xlf index 81096015ee..347d3cffc0 100644 --- a/Apps/IN/INGST/app/Translations/India GST.en-GB.xlf +++ b/Apps/IN/INGST/app/Translations/India GST.en-GB.xlf @@ -9649,7 +9649,12 @@ GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {AFA9BC82-6757-44E3-B5E4-00029DACDA64}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {8EECE1FD-4BDB-4A37-92ED-00380C170CFC}Lbl - GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {46054EB7-3CE7-421C-B047-00658AC5C150}Lbl + + GST Use Cases + + + Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {46054EB7-3CE7-421C-B047-00658AC5C150}Lbl + GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {E9E7486C-DBFB-432C-886F-017AD828CE5E}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {6D031AA1-2009-4D4A-A8E7-01D9116EDC5C}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {87FB95AD-905D-4832-9EC3-0330B674D601}Lbl @@ -9675,7 +9680,12 @@ Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {4684DF92-D578-4978-B4EC-04ACC07C8206}Lbl - GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {668C2032-DD90-4A23-8F30-04B69FE7C99E}Lbl + + GST Use Cases + + + Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {668C2032-DD90-4A23-8F30-04B69FE7C99E}Lbl + GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {C89845E0-C8B1-45B1-9C1B-04EC264B7AC7}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {76F9EC4B-C6F3-4DBE-B1CA-04EFC5AD609E}Lbl diff --git a/Apps/IN/INGST/app/Translations/India GST.en-US.xlf b/Apps/IN/INGST/app/Translations/India GST.en-US.xlf index 02890ad4f6..ae895a4b49 100644 --- a/Apps/IN/INGST/app/Translations/India GST.en-US.xlf +++ b/Apps/IN/INGST/app/Translations/India GST.en-US.xlf @@ -9649,7 +9649,12 @@ GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {AFA9BC82-6757-44E3-B5E4-00029DACDA64}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {8EECE1FD-4BDB-4A37-92ED-00380C170CFC}Lbl - GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {46054EB7-3CE7-421C-B047-00658AC5C150}Lbl + + GST Use Cases + + + Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {46054EB7-3CE7-421C-B047-00658AC5C150}Lbl + GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {E9E7486C-DBFB-432C-886F-017AD828CE5E}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {6D031AA1-2009-4D4A-A8E7-01D9116EDC5C}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {87FB95AD-905D-4832-9EC3-0330B674D601}Lbl @@ -9675,7 +9680,12 @@ Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {4684DF92-D578-4978-B4EC-04ACC07C8206}Lbl - GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {668C2032-DD90-4A23-8F30-04B69FE7C99E}Lbl + + GST Use Cases + + + Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {668C2032-DD90-4A23-8F30-04B69FE7C99E}Lbl + GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {C89845E0-C8B1-45B1-9C1B-04EC264B7AC7}Lbl GST Use Cases Codeunit GST Base Tax Engine Setup - Method GetConfig - NamedType {76F9EC4B-C6F3-4DBE-B1CA-04EFC5AD609E}Lbl diff --git a/Apps/NO/ElectronicVATSubmission/app/src/VAT Return Management/ElecVATCreateContent.Codeunit.al b/Apps/NO/ElectronicVATSubmission/app/src/VAT Return Management/ElecVATCreateContent.Codeunit.al index c07a93de2b..baf816e6c6 100644 --- a/Apps/NO/ElectronicVATSubmission/app/src/VAT Return Management/ElecVATCreateContent.Codeunit.al +++ b/Apps/NO/ElectronicVATSubmission/app/src/VAT Return Management/ElecVATCreateContent.Codeunit.al @@ -53,7 +53,6 @@ codeunit 10684 "Elec. VAT Create Content" VATReportHeader: Record "VAT Report Header"; VATReportingCode: Record "VAT Reporting Code"; VATSpecification: Record "VAT Specification"; - VATNote: Record "VAT Note"; ElecVATXMLHelper: Codeunit "Elec. VAT XML Helper"; ElecVATDataMgt: Codeunit "Elec. VAT Data Mgt."; OriginalVATCode: Code[20]; @@ -106,16 +105,7 @@ codeunit 10684 "Elec. VAT Create Content" ElecVATXMLHelper.AppendXMLNode('sats', Format(VATReportingCode."VAT Rate For Reporting", 0, '')); end; ElecVATXMLHelper.AppendXMLNode('merverdiavgift', GetAmountTextRounded(GetReportingVATAmountFromVATStatementReportLine(TempVATStatementReportLine, VATReportingCode))); - if (VATReportingCode."VAT Note Code" <> '') or (TempVATStatementReportLine.Note <> '') then begin - ElecVATXMLHelper.AddNewXMLNode('merknad', ''); - if VATReportingCode."VAT Note Code" = '' then - ElecVATXMLHelper.AppendXMLNode('beskrivelse', TempVATStatementReportLine.Note) - else begin - VATNote.Get(VATReportingCode."VAT Note Code"); - ElecVATXMLHelper.AppendXMLNode('utvalgtMerknad', VATNote."VAT Report Value"); - end; - ElecVATXMLHelper.FinalizeXMLNode(); - end; + AddNoteToXML(ElecVATXMLHelper, VATReportingCode, TempVATStatementReportLine); ElecVATXMLHelper.FinalizeXMLNode(); if IsReverseCharge then begin ElecVATXMLHelper.AddNewXMLNode('mvaSpesifikasjonslinje', ''); @@ -126,12 +116,7 @@ codeunit 10684 "Elec. VAT Create Content" end; ElecVATXMLHelper.AppendXMLNode('mvaKodeRegnskapsystem', TempVATStatementReportLine.Description); ElecVATXMLHelper.AppendXMLNode('merverdiavgift', GetAmountTextRounded(-TempVATStatementReportLine.Amount)); - if VATReportingCode."VAT Note Code" <> '' then begin - VATNote.Get(VATReportingCode."VAT Note Code"); - ElecVATXMLHelper.AddNewXMLNode('merknad', ''); - ElecVATXMLHelper.AppendXMLNode('utvalgtMerknad', VATNote."VAT Report Value"); - ElecVATXMLHelper.FinalizeXMLNode(); - end; + AddNoteToXML(ElecVATXMLHelper, VATReportingCode, TempVATStatementReportLine); ElecVATXMLHelper.FinalizeXMLNode(); end; until TempVATStatementReportLine.Next() = 0; @@ -312,4 +297,20 @@ codeunit 10684 "Elec. VAT Create Content" exit(VATStatementReportLine.Amount); exit(VATStatementReportLine.Amount + VATStatementReportLine."Non-Deductible Amount"); end; + + local procedure AddNoteToXML(var ElecVATXMLHelper: Codeunit "Elec. VAT XML Helper"; VATReportingCode: Record "VAT Reporting Code"; VATStatementReportLine: Record "VAT Statement Report Line") + var + VATNote: Record "VAT Note"; + begin + if (VATReportingCode."VAT Note Code" <> '') or (VATStatementReportLine.Note <> '') then begin + ElecVATXMLHelper.AddNewXMLNode('merknad', ''); + if VATReportingCode."VAT Note Code" = '' then + ElecVATXMLHelper.AppendXMLNode('beskrivelse', VATStatementReportLine.Note) + else begin + VATNote.Get(VATReportingCode."VAT Note Code"); + ElecVATXMLHelper.AppendXMLNode('utvalgtMerknad', VATNote."VAT Report Value"); + end; + ElecVATXMLHelper.FinalizeXMLNode(); + end; + end; } diff --git a/Apps/NO/ElectronicVATSubmission/test/src/ElecVATSubmissionXMLTests.Codeunit.al b/Apps/NO/ElectronicVATSubmission/test/src/ElecVATSubmissionXMLTests.Codeunit.al index ef0770cd41..167c260b1b 100644 --- a/Apps/NO/ElectronicVATSubmission/test/src/ElecVATSubmissionXMLTests.Codeunit.al +++ b/Apps/NO/ElectronicVATSubmission/test/src/ElecVATSubmissionXMLTests.Codeunit.al @@ -515,6 +515,35 @@ codeunit 148131 "Elec. VAT Submission XML Tests" VATStatementReportLine.Base + VATStatementReportLine."Non-Deductible Base", VATStatementReportLine.Amount + VATStatementReportLine."Non-Deductible Amount"); end; + [Test] + procedure VATCode81NegativeValueWithNote() + var + VATReportHeader: Record "VAT Report Header"; + VATStatementReportLine: Record "VAT Statement Report Line"; + TempXMLBuffer: Record "XML Buffer" temporary; + VATReportMediator: Codeunit "VAT Report Mediator"; + begin + // [SCENARIO 544346] Stan can report the negative VAT for code 81 with a note in the electronic VAT declaration + + Initialize(); + SetVATRegNoInCompanyInfo(GetVATRegNoWithLetters()); + // [GIVEN] VAT return with "VAT %" = 25, Base = -150, Amount = -35 and Note = "This is correction" + InsertMonthlyElecVATReportHeader(VATReportHeader); + // [GIVEN] VAT Code is 81 + LibraryElecVATSubmission.InsertVATStatementReportLineWithBoxNo(VATStatementReportLine, VATReportHeader, GetReverseChargeVATCode()); + VATStatementReportLine.Base := -VATStatementReportLine.Base; + VATStatementReportLine.Amount := -VATStatementReportLine.Amount; + VATStatementReportLine.Note := LibraryUtility.GenerateGUID(); + VATStatementReportLine.Modify(); + + // [WHEN] Generate Electronic VAT declaration message + VATReportMediator.Generate(VATReportHeader); + + // [THEN] XML message is generated with two mvaSpesifikasjonslinje/merknad/beskrivelse = "This is correction" + LoadFromVATReportSubmissionArchive(TempXMLBuffer, VATReportHeader); + VerifyVATNotesValueInSubmissionMessage(VATReportHeader, VATStatementReportLine.Note); + end; + local procedure Initialize() begin LibraryTestInitialize.OnTestInitialize(CODEUNIT::"Elec. VAT Submission XML Tests"); @@ -716,4 +745,19 @@ codeunit 148131 "Elec. VAT Submission XML Tests" TempXMLBuffer, 'mvaMeldingDto/skattegrunnlagOgBeregnetSkatt/mvaSpesifikasjonslinje/merknad/utvalgtMerknad'); Assert.RecordCount(TempXMLBuffer, 0); end; + + local procedure VerifyVATNotesValueInSubmissionMessage(VATReportHeader: Record "VAT Report Header"; VATNoteValue: Text) + var + TempXMLBuffer: Record "XML Buffer" temporary; + VATReportMediator: Codeunit "VAT Report Mediator"; + begin + VATReportMediator.Generate(VATReportHeader); + LoadFromVATReportSubmissionArchive(TempXMLBuffer, VATReportHeader); + TempXMLBuffer.FindNodesByXPath( + TempXMLBuffer, 'mvaMeldingDto/skattegrunnlagOgBeregnetSkatt/mvaSpesifikasjonslinje/merknad/beskrivelse'); + Assert.RecordCount(TempXMLBuffer, 2); + TempXMLBuffer.TestField(Value, VATNoteValue); + TempXMLBuffer.Next(); + TempXMLBuffer.TestField(Value, VATNoteValue); + end; } diff --git a/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/CompanyCreationWizard.Codeunit.al b/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/CompanyCreationWizard.Codeunit.al index b302e65192..5e6135a708 100644 --- a/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/CompanyCreationWizard.Codeunit.al +++ b/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/CompanyCreationWizard.Codeunit.al @@ -1,6 +1,10 @@ +#pragma warning disable AS0072 codeunit 4786 "Company Creation Wizard" { Permissions = tabledata "Assisted Company Setup Status" = rm; + ObsoleteTag = '25.0'; + ObsoleteReason = 'Changing the way demo data is generated, for more infromation see https://go.microsoft.com/fwlink/?linkid=2288084'; + ObsoleteState = Pending; [EventSubscriber(ObjectType::Page, Page::"Company Creation Wizard", 'OnOpenPageCheckAdditionalDemoData', '', false, false)] local procedure SetAdditionalDemoDataVisible(var AdditionalDemoDataVisible: Boolean) @@ -36,4 +40,5 @@ codeunit 4786 "Company Creation Wizard" Telemetry: Codeunit Telemetry; ContosoCoffeeDemoDatasetFeatureNameTok: Label 'ContosoCoffeeDemoDataset', Locked = true; ContosoCoffeeDemoDatasetInitilizationTok: Label '%1: installation initialized from Company Creation wizard', Locked = true; -} \ No newline at end of file +} +#pragma warning restore AS0072 \ No newline at end of file diff --git a/Apps/W1/EDocument/app/Permissions/EDocCoreBasic.PermissionSet.al b/Apps/W1/EDocument/app/Permissions/EDocCoreBasic.PermissionSet.al index e3c3f4e9dc..149349c3ad 100644 --- a/Apps/W1/EDocument/app/Permissions/EDocCoreBasic.PermissionSet.al +++ b/Apps/W1/EDocument/app/Permissions/EDocCoreBasic.PermissionSet.al @@ -6,7 +6,7 @@ namespace Microsoft.eServices.EDocument; using Microsoft.eServices.EDocument.IO.Peppol; using Microsoft.EServices.EDocument.OrderMatch; -using Microsoft.eServices.EDocument.Service; +using Microsoft.eServices.EDocument.Service.Participant; permissionset 6103 "E-Doc. Core - Basic" { diff --git a/Apps/W1/EDocument/app/Permissions/EDocCoreEdit.PermissionSet.al b/Apps/W1/EDocument/app/Permissions/EDocCoreEdit.PermissionSet.al index 75e50ba00e..81acc2e21f 100644 --- a/Apps/W1/EDocument/app/Permissions/EDocCoreEdit.PermissionSet.al +++ b/Apps/W1/EDocument/app/Permissions/EDocCoreEdit.PermissionSet.al @@ -6,7 +6,7 @@ namespace Microsoft.eServices.EDocument; using Microsoft.eServices.EDocument.IO.Peppol; using Microsoft.EServices.EDocument.OrderMatch; -using Microsoft.eServices.EDocument.Service; +using Microsoft.eServices.EDocument.Service.Participant; permissionset 6102 "E-Doc. Core - Edit" { diff --git a/Apps/W1/EDocument/app/Permissions/EDocCoreObjects.PermissionSet.al b/Apps/W1/EDocument/app/Permissions/EDocCoreObjects.PermissionSet.al index 7d75b4ad61..bf944db752 100644 --- a/Apps/W1/EDocument/app/Permissions/EDocCoreObjects.PermissionSet.al +++ b/Apps/W1/EDocument/app/Permissions/EDocCoreObjects.PermissionSet.al @@ -8,7 +8,7 @@ using Microsoft.eServices.EDocument.IO; using Microsoft.eServices.EDocument.IO.Peppol; using Microsoft.EServices.EDocument.OrderMatch; using Microsoft.EServices.EDocument.OrderMatch.Copilot; -using Microsoft.eServices.EDocument.Service; +using Microsoft.eServices.EDocument.Service.Participant; permissionset 6100 "E-Doc. Core - Objects" { @@ -69,6 +69,7 @@ permissionset 6100 "E-Doc. Core - Objects" codeunit "E-Doc. PO AOAI Function" = X, codeunit "E-Doc. PO Copilot Matching" = X, codeunit "E-Doc. Attachment Processor" = X, + codeunit "Service Participant" = X, page "E-Doc. Changes Part" = X, page "E-Doc. Changes Preview" = X, page "E-Document Activities" = X, @@ -90,5 +91,6 @@ permissionset 6100 "E-Doc. Core - Objects" page "E-Doc Service Supported Types" = X, page "E-Doc. PO Copilot Prop" = X, page "E-Doc. PO Match Prop. Sub" = X, - page "E-Doc. Order Match Act." = X; + page "E-Doc. Order Match Act." = X, + page "Service Participants" = X; } diff --git a/Apps/W1/EDocument/app/Permissions/EDocCoreRead.PermissionSet.al b/Apps/W1/EDocument/app/Permissions/EDocCoreRead.PermissionSet.al index 09e2f0f04e..30362c9850 100644 --- a/Apps/W1/EDocument/app/Permissions/EDocCoreRead.PermissionSet.al +++ b/Apps/W1/EDocument/app/Permissions/EDocCoreRead.PermissionSet.al @@ -6,7 +6,7 @@ namespace Microsoft.eServices.EDocument; using Microsoft.eServices.EDocument.IO.Peppol; using Microsoft.EServices.EDocument.OrderMatch; -using Microsoft.eServices.EDocument.Service; +using Microsoft.eServices.EDocument.Service.Participant; permissionset 6101 "E-Doc. Core - Read" { diff --git a/Apps/W1/EDocument/app/src/Extensions/EDocCustomerCard.PageExt.al b/Apps/W1/EDocument/app/src/Extensions/EDocCustomerCard.PageExt.al new file mode 100644 index 0000000000..56b65a1838 --- /dev/null +++ b/Apps/W1/EDocument/app/src/Extensions/EDocCustomerCard.PageExt.al @@ -0,0 +1,50 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.eServices.EDocument.Extensions; + +using Microsoft.Sales.Customer; +using Microsoft.eServices.EDocument; +using Microsoft.eServices.EDocument.Service.Participant; + +/// +/// A page extension for the Customer Card page to show the E-Document service participation. +/// +pageextension 6163 "E-Doc. Customer Card" extends "Customer Card" +{ + layout + { + addlast(Invoicing) + { + field("E-Document Service Participation Ids"; ParticipantIdCount) + { + ApplicationArea = All; + Caption = 'E-Document Service Participation'; + DrillDown = true; + Editable = false; + ToolTip = 'Specifies the customers participation for the E-Document services.'; + + trigger OnDrillDown() + begin + Rec.TestField("No."); + ServiceParticipant.RunServiceParticipantPage(Enum::"E-Document Source Type"::Customer, Rec."No."); + end; + } + } + } + + + var + ServiceParticipant: Codeunit "Service Participant"; + ParticipantIdCount: Integer; + + + trigger OnAfterGetCurrRecord() + begin + Rec.TestField("No."); + ParticipantIdCount := ServiceParticipant.GetParticipantIdCount(Enum::"E-Document Source Type"::Customer, Rec."No."); + end; + +} \ No newline at end of file diff --git a/Apps/W1/EDocument/app/src/Extensions/EDocVendorPage.PageExt.al b/Apps/W1/EDocument/app/src/Extensions/EDocVendorPage.PageExt.al index 901417730d..bf956112fd 100644 --- a/Apps/W1/EDocument/app/src/Extensions/EDocVendorPage.PageExt.al +++ b/Apps/W1/EDocument/app/src/Extensions/EDocVendorPage.PageExt.al @@ -10,8 +10,33 @@ pageextension 6161 "E-Doc. Vendor Page" extends "Vendor Card" Caption = 'Receive E-Document To'; ToolTip = 'Specifies the default purchase document to be generated from received E-document. Users can select either a Purchase Invoice or Purchase Order. This selection does not affect the creation of corrective documents; in both scenarios, the system will generate a Credit Memo.'; } + field("E-Document Service Participation Ids"; ParticipantIdCount) + { + ApplicationArea = All; + Caption = 'E-Document Service Participation'; + DrillDown = true; + Editable = false; + ToolTip = 'Specifies the vendors participation for the E-Document services.'; + + trigger OnDrillDown() + begin + Rec.TestField("No."); + ServiceParticipant.RunServiceParticipantPage(Enum::"E-Document Source Type"::Vendor, Rec."No."); + end; + } } } + var + ServiceParticipant: Codeunit "Service Participant"; + ParticipantIdCount: Integer; + + + trigger OnAfterGetCurrRecord() + begin + Rec.TestField("No."); + ParticipantIdCount := ServiceParticipant.GetParticipantIdCount(Enum::"E-Document Source Type"::Vendor, Rec."No."); + end; + } \ No newline at end of file diff --git a/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Codeunit.al b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Codeunit.al new file mode 100644 index 0000000000..b2e95d5c80 --- /dev/null +++ b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Codeunit.al @@ -0,0 +1,36 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.eServices.EDocument.Service.Participant; + +using Microsoft.eServices.EDocument; + +/// +/// Function for service participant. +/// +codeunit 6170 "Service Participant" +{ + Access = Internal; + + procedure GetParticipantIdCount(Type: Enum "E-Document Source Type"; Participant: Code[20]): Integer + var + ServiceParticipant: Record "Service Participant"; + begin + ServiceParticipant.SetRange("Participant Type", Enum::"E-Document Source Type"::Vendor); + ServiceParticipant.SetRange(Participant, Participant); + exit(ServiceParticipant.Count()); + end; + + procedure RunServiceParticipantPage(Type: Enum "E-Document Source Type"; Participant: Code[20]): Action + var + ServiceParticipant: Record "Service Participant"; + ServiceParticipantPage: Page "Service Participants"; + begin + ServiceParticipant.SetRange("Participant Type", Type); + ServiceParticipant.SetRange(Participant, Participant); + ServiceParticipantPage.SetTableView(ServiceParticipant); + exit(ServiceParticipantPage.RunModal()); + end; + +} \ No newline at end of file diff --git a/Apps/W1/EDocument/app/src/Service/ServiceParticipant.Table.al b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Table.al similarity index 76% rename from Apps/W1/EDocument/app/src/Service/ServiceParticipant.Table.al rename to Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Table.al index 1f282b2cf9..cbaf59562f 100644 --- a/Apps/W1/EDocument/app/src/Service/ServiceParticipant.Table.al +++ b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipant.Table.al @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // ------------------------------------------------------------------------------------------------ -namespace Microsoft.eServices.EDocument.Service; +namespace Microsoft.eServices.EDocument.Service.Participant; using Microsoft.Sales.Customer; using Microsoft.Purchases.Vendor; @@ -15,7 +15,7 @@ using Microsoft.eServices.EDocument; table 6104 "Service Participant" { Access = Public; - Extensible = false; + Extensible = true; DataClassification = SystemMetadata; fields @@ -24,10 +24,12 @@ table 6104 "Service Participant" { TableRelation = "E-Document Service"; Caption = 'Service'; + ToolTip = 'Specifies the E-Document service for which the participant is associated.'; } field(2; "Participant Type"; Enum "E-Document Source Type") { Caption = 'Participant Type'; + ToolTip = 'Specifies the type of participant associated with the E-Document service.'; } field(3; Participant; Code[20]) { @@ -35,11 +37,13 @@ table 6104 "Service Participant" else if ("Participant Type" = const(Vendor)) Vendor; Caption = 'Participant'; + ToolTip = 'Specifies the participant associated with the E-Document service.'; } field(4; "Participant Identifier"; Text[200]) { - Caption = 'Participant Identifier'; DataClassification = CustomerContent; + Caption = 'Participant Identifier'; + ToolTip = 'Specifies the identifier of the participant associated with the E-Document service.'; } } diff --git a/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipants.Page.al b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipants.Page.al new file mode 100644 index 0000000000..53674991bc --- /dev/null +++ b/Apps/W1/EDocument/app/src/Service/Participant/ServiceParticipants.Page.al @@ -0,0 +1,49 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.eServices.EDocument.Service.Participant; + + +/// +/// Represents the service participant. +/// Table allows a participant (Customer/Vendor/Etc.) to be associated with multiple services. +/// +page 6150 "Service Participants" +{ + PageType = List; + ApplicationArea = All; + UsageCategory = None; + SourceTable = "Service Participant"; + Extensible = true; + + layout + { + area(Content) + { + repeater(Default) + { + field(Service; Rec.Service) + { + ApplicationArea = All; + Caption = 'E-Document Service'; + } + field("Participant Type"; Rec."Participant Type") + { + ApplicationArea = All; + Caption = 'Participant Type'; + } + field(Participant; Rec.Participant) + { + ApplicationArea = All; + Caption = 'Participant'; + } + field("Participant Identifier"; Rec."Participant Identifier") + { + ApplicationArea = All; + Caption = 'Participant Identifier'; + } + } + } + } +} \ No newline at end of file diff --git a/Apps/W1/PowerBIReports/test/src/Codeunits/PowerBIManufacturingTest.Codeunit.al b/Apps/W1/PowerBIReports/test/src/Codeunits/PowerBIManufacturingTest.Codeunit.al index 84b62c8748..4bef7f9781 100644 --- a/Apps/W1/PowerBIReports/test/src/Codeunits/PowerBIManufacturingTest.Codeunit.al +++ b/Apps/W1/PowerBIReports/test/src/Codeunits/PowerBIManufacturingTest.Codeunit.al @@ -21,6 +21,7 @@ codeunit 139878 "PowerBI Manufacturing Test" { Subtype = Test; Access = Internal; + TestPermissions = Disabled; var Assert: Codeunit Assert; diff --git a/Apps/W1/Shopify/app/src/Base/Codeunits/ShpfyInstaller.Codeunit.al b/Apps/W1/Shopify/app/src/Base/Codeunits/ShpfyInstaller.Codeunit.al index 891527bebb..b6a9d55ba2 100644 --- a/Apps/W1/Shopify/app/src/Base/Codeunits/ShpfyInstaller.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Base/Codeunits/ShpfyInstaller.Codeunit.al @@ -33,7 +33,7 @@ codeunit 30273 "Shpfy Installer" UpgradeTag: Codeunit "Upgrade Tag"; IsInitialSetup: Boolean; begin - IsInitialSetup := not UpgradeTag.HasUpgradeTag(GetShopifyLogEntryAddedToAllowedListUpgradeTag()); + IsInitialSetup := not UpgradeTag.HasUpgradeTag(GetShopifyRetentionPolicySetupUpgradeTag()); if not (IsInitialSetup or ForceUpdate) then exit; @@ -47,7 +47,7 @@ codeunit 30273 "Shpfy Installer" CreateRetentionPolicySetup(Database::"Shpfy Log Entry", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month")); CreateRetentionPolicySetup(Database::"Shpfy Data Capture", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month")); CreateRetentionPolicySetup(Database::"Shpfy Skipped Record", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month")); - UpgradeTag.SetUpgradeTag(GetShopifyLogEntryAddedToAllowedListUpgradeTag()); + UpgradeTag.SetUpgradeTag(GetShopifyRetentionPolicySetupUpgradeTag()); end; local procedure CreateRetentionPolicySetup(TableId: Integer; RetentionPeriodCode: Code[20]) @@ -152,9 +152,9 @@ codeunit 30273 "Shpfy Installer" exit('MS-522567-ShopifyCueSetupAdded-20240326'); end; - local procedure GetShopifyLogEntryAddedToAllowedListUpgradeTag(): Code[250] + local procedure GetShopifyRetentionPolicySetupUpgradeTag(): Code[250] begin - exit('MS-474464-ShopifyLogEntryAdded-20230601'); + exit('MS-473306-ShopifyRetentionPolicySetupAdded-20241029'); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Reten. Pol. Allowed Tables", OnRefreshAllowedTables, '', false, false)] diff --git a/Apps/W1/Shopify/app/src/Companies/Codeunits/ShpfyCompanyExport.Codeunit.al b/Apps/W1/Shopify/app/src/Companies/Codeunits/ShpfyCompanyExport.Codeunit.al index 4420db5c16..e9cc6ce57b 100644 --- a/Apps/W1/Shopify/app/src/Companies/Codeunits/ShpfyCompanyExport.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Companies/Codeunits/ShpfyCompanyExport.Codeunit.al @@ -39,13 +39,14 @@ codeunit 30284 "Shpfy Company Export" SkippedRecord: Codeunit "Shpfy Skipped Record"; CreateCustomers: Boolean; CountyCodeTooLongLbl: Label 'Can not export customer %1 %2. The length of the string is %3, but it must be less than or equal to %4 characters. Value: %5, field: %6', Comment = '%1 - Customer No., %2 - Customer Name, %3 - Length, %4 - Max Length, %5 - Value, %6 - Field Name'; + EmptyEmailAddressLbl: Label 'Customer (Company) has no e-mail address.'; + CompanyWithPhoneNoOrEmailExistsLbl: Label 'Company already exists with the same e-mail or phone.'; local procedure CreateShopifyCompany(Customer: Record Customer) var ShopifyCompany: Record "Shpfy Company"; ShopifyCustomer: Record "Shpfy Customer"; CompanyLocation: Record "Shpfy Company Location"; - EmptyEmailAddressLbl: Label 'Customer (Company) has no e-mail address.'; begin if Customer."E-Mail" = '' then begin SkippedRecord.LogSkippedRecord(Customer.RecordId, EmptyEmailAddressLbl, Shop); @@ -184,7 +185,6 @@ codeunit 30284 "Shpfy Company Export" var ShopifyCompany: Record "Shpfy Company"; CompanyLocation: Record "Shpfy Company Location"; - CompanyWithPhoneNoOrEmailExistsLbl: Label 'Company already exists with the same e-mail or phone.'; begin ShopifyCompany.Get(CompanyId); if ShopifyCompany."Customer SystemId" <> Customer.SystemId then begin diff --git a/Apps/W1/Shopify/app/src/Customers/Codeunits/ShpfyCustomerExport.Codeunit.al b/Apps/W1/Shopify/app/src/Customers/Codeunits/ShpfyCustomerExport.Codeunit.al index a02698eada..a7c80ce31e 100644 --- a/Apps/W1/Shopify/app/src/Customers/Codeunits/ShpfyCustomerExport.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Customers/Codeunits/ShpfyCustomerExport.Codeunit.al @@ -42,6 +42,8 @@ codeunit 30116 "Shpfy Customer Export" SkippedRecord: Codeunit "Shpfy Skipped Record"; CreateCustomers: Boolean; CountyCodeTooLongLbl: Label 'Can not export customer %1 %2. The length of the string is %3, but it must be less than or equal to %4 characters. Value: %5, field: %6', Comment = '%1 - Customer No., %2 - Customer Name, %3 - Length, %4 - Max Length, %5 - Value, %6 - Field Name'; + EmptyEmailAddressLbl: Label 'Customer has no e-mail address.'; + CustomerWithPhoneNoOrEmailExistsLbl: Label 'Customer already exists with the same e-mail or phone.'; /// @@ -52,7 +54,6 @@ codeunit 30116 "Shpfy Customer Export" var ShopifyCustomer: Record "Shpfy Customer"; CustomerAddress: Record "Shpfy Customer Address"; - EmptyEmailAddressLbl: Label 'Customer has no e-mail address.'; begin if Customer."E-Mail" = '' then begin SkippedRecord.LogSkippedRecord(Customer.RecordId, EmptyEmailAddressLbl, Shop); @@ -246,7 +247,6 @@ codeunit 30116 "Shpfy Customer Export" var ShopifyCustomer: Record "Shpfy Customer"; CustomerAddress: Record "Shpfy Customer Address"; - CustomerWithPhoneNoOrEmailExistsLbl: Label 'Customer already exists with the same e-mail or phone.'; begin ShopifyCustomer.Get(CustomerID); if ShopifyCustomer."Customer SystemId" <> Customer.SystemId then begin @@ -281,4 +281,4 @@ codeunit 30116 "Shpfy Customer Export" begin MetafieldAPI.CreateOrUpdateMetafieldsInShopify(Database::"Shpfy Customer", CustomerId); end; -} \ No newline at end of file +} diff --git a/Apps/W1/Shopify/app/src/GraphQL/Codeunits/ShpfyGQLCustomerMetafieldIds.Codeunit.al b/Apps/W1/Shopify/app/src/GraphQL/Codeunits/ShpfyGQLCustomerMetafieldIds.Codeunit.al index 2dc821806a..b81161bcff 100644 --- a/Apps/W1/Shopify/app/src/GraphQL/Codeunits/ShpfyGQLCustomerMetafieldIds.Codeunit.al +++ b/Apps/W1/Shopify/app/src/GraphQL/Codeunits/ShpfyGQLCustomerMetafieldIds.Codeunit.al @@ -1,4 +1,5 @@ namespace Microsoft.Integration.Shopify; + /// /// Codeunit Shpfy GQL Customer Metafield Ids (ID 30374) implements Interface Shpfy IGraphQL. /// diff --git a/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyPostedInvoiceExport.Codeunit.al b/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyPostedInvoiceExport.Codeunit.al index ec298d736b..57b0552db2 100644 --- a/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyPostedInvoiceExport.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyPostedInvoiceExport.Codeunit.al @@ -24,6 +24,15 @@ codeunit 30362 "Shpfy Posted Invoice Export" ExportPostedSalesInvoiceToShopify(Rec); end; + var + CustomerNotExistInShopifyLbl: Label 'Customer does not exists as Shopify company or customer.'; + PaymentTermsNotExistLbl: Label 'Payment terms %1 do not exist in Shopify.', Comment = '%1 = Payment Terms Code.'; + CustomerNoIsDefaultCustomerNoLbl: Label 'Bill-to customer no. is the default customer no. for Shopify shop.'; + CustomerTemplateExistsLbl: Label 'Shopify customer template exists for customer no. %1 shop %2.', Comment = '%1 = Customer No., %2 = Shop Code'; + NoLinesInSalesInvoiceLbl: Label 'No relevant sales invoice lines exist.'; + InvalidQuantityLbl: Label 'Invalid quantity in sales invoice line.'; + EmptyNoInLineLbl: Label 'No. field is empty in Sales Invoice Line.'; + /// /// Sets a global shopify shop to be used for posted invoice export. /// @@ -93,10 +102,6 @@ codeunit 30362 "Shpfy Posted Invoice Export" var ShopifyCompany: Record "Shpfy Company"; ShopifyCustomer: Record "Shpfy Customer"; - CustomerNotExistInShopifyLbl: Label 'Customer does not exists as Shopify company or customer.'; - PaymentTermsNotExistLbl: Label 'Payment terms %1 do not exist in Shopify.', Comment = '%1 = Payment Terms Code.'; - CustomerNoIsDefaultCustomerNoLbl: Label 'Bill-to customer no. is the default customer no. for Shopify shop.'; - CustomerTemplateExistsLbl: Label 'Shopify customer template exists for customer no. %1 shop %2.', Comment = '%1 = Customer No., %2 = Shop Code'; begin ShopifyCompany.SetRange("Customer No.", SalesInvoiceHeader."Bill-to Customer No."); if ShopifyCompany.IsEmpty() then begin @@ -158,9 +163,6 @@ codeunit 30362 "Shpfy Posted Invoice Export" local procedure CheckSalesInvoiceHeaderLines(SalesInvoiceHeader: Record "Sales Invoice Header"): Boolean var SalesInvoiceLine: Record "Sales Invoice Line"; - NoLinesInSalesInvoiceLbl: Label 'No relevant sales invoice lines exist.'; - InvalidQuantityLbl: Label 'Invalid quantity in sales invoice line.'; - EmptyNoInLineLbl: Label 'No. field is empty in Sales Invoice Line.'; begin SalesInvoiceLine.SetRange("Document No.", SalesInvoiceHeader."No."); SalesInvoiceLine.SetFilter(Type, '<>%1', SalesInvoiceLine.Type::" "); diff --git a/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkipRecordMgt.Codeunit.al b/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkipRecordMgt.Codeunit.al deleted file mode 100644 index 9c0f4a5eaf..0000000000 --- a/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkipRecordMgt.Codeunit.al +++ /dev/null @@ -1,44 +0,0 @@ -namespace Microsoft.Integration.Shopify; - -/// -/// Codeunit Shpfy Skip Record (ID 30313). -/// -codeunit 30313 "Shpfy Skipped Record" -{ - Access = Internal; - Permissions = tabledata "Shpfy Skipped Record" = rimd; - - /// - /// Creates log entry for skipped record. - /// - /// Related Shopify Id of the record. - /// Table Id of the record. - /// Record Id of the record. - /// Reason for skipping the record. - /// Shop record. - internal procedure LogSkippedRecord(ShopifyId: BigInteger; RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") - var - SkippedRecord: Record "Shpfy Skipped Record"; - begin - if Shop."Logging Mode" = Enum::"Shpfy Logging Mode"::Disabled then - exit; - SkippedRecord.Init(); - SkippedRecord.Validate("Shopify Id", ShopifyId); - SkippedRecord.Validate("Table ID", RecordId.TableNo()); - SkippedRecord.Validate("Record ID", RecordId); - SkippedRecord.Validate("Skipped Reason", SkippedReason); - SkippedRecord.Insert(true); - end; - - /// - /// Creates log entry for skipped recordwith empty Shopify Id. - /// - /// Record Id of the record. - /// Reason for skipping the record. - /// Shop record. - internal procedure LogSkippedRecord(RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") - begin - LogSkippedRecord(0, RecordId, SkippedReason, Shop); - end; - -} diff --git a/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al b/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al index 9c0f4a5eaf..732a6210f7 100644 --- a/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al @@ -1,7 +1,7 @@ namespace Microsoft.Integration.Shopify; /// -/// Codeunit Shpfy Skip Record (ID 30313). +/// Codeunit Shpfy Skipped Record (ID 30313). /// codeunit 30313 "Shpfy Skipped Record" { diff --git a/Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al b/Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al index ceeda2df49..b8948746d7 100644 --- a/Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al +++ b/Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al @@ -57,7 +57,7 @@ page 30166 "Shpfy Skipped Records" action(Show) { ApplicationArea = All; - Caption = 'Show record'; + Caption = 'Show Record'; Image = View; ToolTip = 'Show the details of the selected record.'; diff --git a/Apps/W1/Shopify/app/src/Logs/Tables/ShpfySkippedRecord.Table.al b/Apps/W1/Shopify/app/src/Logs/Tables/ShpfySkippedRecord.Table.al index 90734c6c31..98052e933b 100644 --- a/Apps/W1/Shopify/app/src/Logs/Tables/ShpfySkippedRecord.Table.al +++ b/Apps/W1/Shopify/app/src/Logs/Tables/ShpfySkippedRecord.Table.al @@ -19,7 +19,6 @@ table 30159 "Shpfy Skipped Record" AutoIncrement = true; Caption = 'Entry No.'; ToolTip = 'Specifies the number of the entry, as assigned from the specific number series when the entry was created.'; - } field(2; "Shopify Id"; BigInteger) { @@ -84,7 +83,7 @@ table 30159 "Shpfy Skipped Record" exit(AllObjWithCaption."Object Caption"); end; - local procedure GetRecDescription() Result: Text + local procedure GetRecDescription() Result: Text[250] var RecRef: RecordRef; PKFilter: Text; diff --git a/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCompany.Codeunit.al b/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCompany.Codeunit.al index 44ef1d693a..fdce02510e 100644 --- a/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCompany.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCompany.Codeunit.al @@ -43,7 +43,7 @@ codeunit 30366 "Shpfy Metafield Owner Company" implements "Shpfy IMetafield Owne procedure CanEditMetafields(Shop: Record "Shpfy Shop"): Boolean begin - exit((Shop."Can Update Shopify Companies") and (Shop."Company Import From Shopify" <> Enum::"Shpfy Company Import Range"::AllCompanies)); + exit(Shop."Can Update Shopify Companies"); end; } diff --git a/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCustomer.Codeunit.al b/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCustomer.Codeunit.al index 779fd82d80..0f4713b44d 100644 --- a/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCustomer.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Metafields/Codeunits/IOwnerType/ShpfyMetafieldOwnerCustomer.Codeunit.al @@ -23,7 +23,7 @@ codeunit 30333 "Shpfy Metafield Owner Customer" implements "Shpfy IMetafield Own Parameters.Add('CustomerId', Format(OwnerId)); GraphQLType := GraphQLType::CustomerMetafieldIds; JResponse := CommunicationMgt.ExecuteGraphQL(GraphQLType, Parameters); - if JsonHelper.GetJsonArray(JResponse, JMetafields, 'data.customer.metafields.edges') then + if JsonHelper.GetJsonArray(JResponse, JMetafields, 'data.product.metafields.edges') then foreach JItem in JMetafields do if JsonHelper.GetJsonObject(JItem.AsObject(), JNode, 'node') then begin Id := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JNode, 'legacyResourceId')); @@ -45,6 +45,6 @@ codeunit 30333 "Shpfy Metafield Owner Customer" implements "Shpfy IMetafield Own procedure CanEditMetafields(Shop: Record "Shpfy Shop"): Boolean begin - exit((Shop."Can Update Shopify Customer") and (Shop."Customer Import From Shopify" <> Enum::"Shpfy Customer Import Range"::AllCustomers)); + exit(Shop."Can Update Shopify Customer"); end; } \ No newline at end of file diff --git a/Apps/W1/Shopify/app/src/PermissionSets/ShpfyObjects.PermissionSet.al b/Apps/W1/Shopify/app/src/PermissionSets/ShpfyObjects.PermissionSet.al index 97769ebac1..3a87fd89b6 100644 --- a/Apps/W1/Shopify/app/src/PermissionSets/ShpfyObjects.PermissionSet.al +++ b/Apps/W1/Shopify/app/src/PermissionSets/ShpfyObjects.PermissionSet.al @@ -59,6 +59,7 @@ permissionset 30104 "Shpfy - Objects" table "Shpfy Shop Collection Map" = X, table "Shpfy Shop Inventory" = X, table "Shpfy Shop Location" = X, + table "Shpfy Skipped Record" = X, table "Shpfy Suggest Payment" = X, table "Shpfy Synchronization Info" = X, table "Shpfy Tag" = X, @@ -151,6 +152,7 @@ permissionset 30104 "Shpfy - Objects" codeunit "Shpfy GQL CompanyAssignContact" = X, codeunit "Shpfy GQL CompanyAssignMainCon" = X, codeunit "Shpfy GQL CompanyIds" = X, + codeunit "Shpfy GQL CompanyMetafieldIds" = X, codeunit "Shpfy GQL CreateCatalog" = X, codeunit "Shpfy GQL CreateFulfillmentSvc" = X, codeunit "Shpfy GQL CreatePriceList" = X, @@ -158,6 +160,7 @@ permissionset 30104 "Shpfy - Objects" codeunit "Shpfy GQL CreateUploadUrl" = X, codeunit "Shpfy GQL Customer" = X, codeunit "Shpfy GQL CustomerIds" = X, + codeunit "Shpfy GQL CustomerMetafieldIds" = X, codeunit "Shpfy GQL DraftOrderComplete" = X, codeunit "Shpfy GQL FFOrdersFromOrder" = X, codeunit "Shpfy GQL FindCustByEMail" = X, @@ -245,6 +248,7 @@ permissionset 30104 "Shpfy - Objects" codeunit "Shpfy Log Entries Delete" = X, codeunit "Shpfy Math" = X, codeunit "Shpfy Metafield API" = X, + codeunit "Shpfy Metafield Owner Company" = X, codeunit "Shpfy Metafield Owner Customer" = X, codeunit "Shpfy Metafield Owner Product" = X, codeunit "Shpfy Metafield Owner Variant" = X, @@ -319,6 +323,7 @@ permissionset 30104 "Shpfy - Objects" codeunit "Shpfy Shipping Events" = X, codeunit "Shpfy Shipping Methods" = X, codeunit "Shpfy Shop Mgt." = X, + codeunit "Shpfy Skipped Record" = X, codeunit "Shpfy Suggest Payments" = X, codeunit "Shpfy Suppress Asm Warning" = X, codeunit "Shpfy Sync Catalog Prices" = X, @@ -401,6 +406,7 @@ permissionset 30104 "Shpfy - Objects" page "Shpfy Shop Locations Mapping" = X, page "Shpfy Shop Selection" = X, page "Shpfy Shops" = X, + page "Shpfy Skipped Records" = X, page "Shpfy Tag Factbox" = X, page "Shpfy Tags" = X, page "Shpfy Tax Areas" = X, diff --git a/Apps/W1/Shopify/app/src/Products/Codeunits/ShpfyProductExport.Codeunit.al b/Apps/W1/Shopify/app/src/Products/Codeunits/ShpfyProductExport.Codeunit.al index 8214a617c9..329e3ff100 100644 --- a/Apps/W1/Shopify/app/src/Products/Codeunits/ShpfyProductExport.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Products/Codeunits/ShpfyProductExport.Codeunit.al @@ -66,6 +66,9 @@ codeunit 30178 "Shpfy Product Export" BulkOperationInput: TextBuilder; GraphQueryList: List of [TextBuilder]; VariantPriceCalcSkippedLbl: Label 'Variant price is not synchronized because the item is blocked or sales blocked.'; + ItemIsBlockedLbl: Label 'Item is blocked.'; + ItemIsDraftLbl: Label 'Shopify product is in draft status.'; + ItemIsArchivedLbl: Label 'Shopify product is archived.'; /// /// Creates html body for a product from extended text, marketing text and attributes. @@ -552,9 +555,6 @@ codeunit 30178 "Shpfy Product Export" RecordRef1: RecordRef; RecordRef2: RecordRef; VariantAction: Option " ",Create,Update; - ItemIsBlockedLbl: Label 'Item is blocked.'; - ItemIsDraftLbl: Label 'Shopify product is in draft status.'; - ItemIsArchivedLbl: Label 'Shopify product is archived.'; begin if ShopifyProduct.Get(ProductId) and Item.GetBySystemId(ShopifyProduct."Item SystemId") then begin case Shop."Action for Removed Products" of diff --git a/Apps/W1/Shopify/app/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al b/Apps/W1/Shopify/app/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al index d81e737815..4ec03c3143 100644 --- a/Apps/W1/Shopify/app/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al +++ b/Apps/W1/Shopify/app/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al @@ -17,6 +17,8 @@ codeunit 30190 "Shpfy Export Shipments" var ShopifyCommunicationMgt: Codeunit "Shpfy Communication Mgt."; ShippingEvents: Codeunit "Shpfy Shipping Events"; + NoCorrespondingFulfillmentLinesLbl: Label 'No corresponding fulfillment lines found.'; + NoFulfillmentCreatedInShopifyLbl: Label 'Fulfillment was not created in Shopify.'; /// /// Create Shopify Fulfillment. @@ -44,8 +46,6 @@ codeunit 30190 "Shpfy Export Shipments" JFulfillment: JsonToken; JResponse: JsonToken; FulfillmentOrderRequest: Text; - NoCorrespondingFulfillmentLinesLbl: Label 'No corresponding fulfillment lines found.'; - NoFulfillmentCreatedInShopifyLbl: Label 'Fulfillment was not created in Shopify.'; begin if ShopifyOrderHeader.Get(SalesShipmentHeader."Shpfy Order Id") then begin ShopifyCommunicationMgt.SetShop(ShopifyOrderHeader."Shop Code"); diff --git a/Apps/W1/Shopify/app/src/Shipping/Reports/ShpfySyncShipmToShopify.Report.al b/Apps/W1/Shopify/app/src/Shipping/Reports/ShpfySyncShipmToShopify.Report.al index 13764c784b..63bcd5f874 100644 --- a/Apps/W1/Shopify/app/src/Shipping/Reports/ShpfySyncShipmToShopify.Report.al +++ b/Apps/W1/Shopify/app/src/Shipping/Reports/ShpfySyncShipmToShopify.Report.al @@ -32,8 +32,6 @@ report 30109 "Shpfy Sync Shipm. to Shopify" ShipmentLine: Record "Sales Shipment Line"; Shop: Record "Shpfy Shop"; SkippedRecord: Codeunit "Shpfy Skipped Record"; - NoLinesApplicableLbl: Label 'No lines applicable for fulfillment.'; - ShopifyOrderNotExistsLbl: Label 'Shopify order %1 does not exist.', Comment = '%1 = Shopify Order Id'; begin ShipmentLine.SetRange("Document No.", "No."); ShipmentLine.SetRange(Type, ShipmentLine.Type::"Item"); @@ -56,4 +54,6 @@ report 30109 "Shpfy Sync Shipm. to Shopify" var ExportShipments: Codeunit "Shpfy Export Shipments"; FulfillmentOrdersAPI: Codeunit "Shpfy Fulfillment Orders API"; + NoLinesApplicableLbl: Label 'No lines applicable for fulfillment.'; + ShopifyOrderNotExistsLbl: Label 'Shopify order %1 does not exist.', Comment = '%1 = Shopify Order Id'; } \ No newline at end of file diff --git a/Apps/W1/Shopify/test/Logs/ShpfySkippedRecordLogTest.Codeunit.al b/Apps/W1/Shopify/test/Logs/ShpfySkippedRecordLogTest.Codeunit.al index 783d41bb29..98ba52cb06 100644 --- a/Apps/W1/Shopify/test/Logs/ShpfySkippedRecordLogTest.Codeunit.al +++ b/Apps/W1/Shopify/test/Logs/ShpfySkippedRecordLogTest.Codeunit.al @@ -19,6 +19,7 @@ codeunit 139581 "Shpfy Skipped Record Log Test" [Test] procedure UnitTestLogEmptyCustomerEmail() var + Customer: Record Customer; SkippedRecord: Record "Shpfy Skipped Record"; begin @@ -64,6 +65,7 @@ codeunit 139581 "Shpfy Skipped Record Log Test" [Test] procedure UnitTestLogProductItemBlocked() var + Item: Record Item; ShpfyItem: Record "Shpfy Product"; SkippedRecord: Record "Shpfy Skipped Record"; @@ -121,6 +123,7 @@ codeunit 139581 "Shpfy Skipped Record Log Test" [Test] procedure UnitTestLogProductItemBlockedAndProductIsDraft() var + Item: Record Item; ShpfyProduct: Record "Shpfy Product"; SkippedRecord: Record "Shpfy Skipped Record"; @@ -287,7 +290,7 @@ codeunit 139581 "Shpfy Skipped Record Log Test" // [GIVEN] Shopify Customer CreateShopifyCustomer(Customer); // [GIVEN] Payment Terms Code - PaymentTermsCode := Any.AlphanumericText(10); + PaymentTermsCode := CopyStr(Any.AlphanumericText(10), 1, MaxStrLen(PaymentTermsCode)); // [GIVEN] Sales Invoice CreateSalesInvoiceHeader(SalesInvoiceHeader, Customer."No.", PaymentTermsCode); @@ -589,7 +592,6 @@ codeunit 139581 "Shpfy Skipped Record Log Test" SkippedRecordCodeunit: Codeunit "Shpfy Skipped Record"; RecordID: RecordID; ShopifyId: BigInteger; - TableId: Integer; begin // [SCENARIO] Skip logging when setup in shop for logging is Disabled. Initialize(); @@ -604,7 +606,7 @@ codeunit 139581 "Shpfy Skipped Record Log Test" // [THEN] No record is created in shopify skipped record table. SkippedRecord.SetRange("Shopify Id", ShopifyId); - SkippedRecord.SetRange("Table Id", TableId); + SkippedRecord.SetRange("Record ID", RecordID); LibraryAssert.IsTrue(SkippedRecord.IsEmpty(), 'Skipped record is created'); end; diff --git a/Apps/W1/Shopify/test/Products/ShpfyCreateItemAsVariantSub.Codeunit.al b/Apps/W1/Shopify/test/Products/ShpfyCreateItemAsVariantSub.Codeunit.al deleted file mode 100644 index 9c65bbc8c5..0000000000 --- a/Apps/W1/Shopify/test/Products/ShpfyCreateItemAsVariantSub.Codeunit.al +++ /dev/null @@ -1,134 +0,0 @@ -codeunit 139620 "Shpfy CreateItemAsVariantSub" -{ - EventSubscriberInstance = Manual; - - var - GraphQueryTxt: Text; - NewVariantId: BigInteger; - DefaultVariantId: BigInteger; - MultipleOptions: Boolean; - - [EventSubscriber(ObjectType::Codeunit, Codeunit::"Shpfy Communication Events", 'OnClientSend', '', true, false)] - local procedure OnClientSend(HttpRequestMessage: HttpRequestMessage; var HttpResponseMessage: HttpResponseMessage) - begin - MakeResponse(HttpRequestMessage, HttpResponseMessage); - end; - - [EventSubscriber(ObjectType::Codeunit, Codeunit::"Shpfy Communication Events", 'OnGetContent', '', true, false)] - local procedure OnGetContent(HttpResponseMessage: HttpResponseMessage; var Response: Text) - begin - HttpResponseMessage.Content.ReadAs(Response); - end; - - local procedure MakeResponse(HttpRequestMessage: HttpRequestMessage; var HttpResponseMessage: HttpResponseMessage) - var - Uri: Text; - GraphQlQuery: Text; - CreateItemVariantTok: Label '{"query":"mutation { productVariantCreate(input: {productId: \"gid://shopify/Product/', locked = true; - GetOptionsStartTok: Label '{"query":"{product(id: \"gid://shopify/Product/', locked = true; - GetOptionsEndTok: Label '\") {id title options {id name}}}"}', Locked = true; - RemoveVariantStartTok: Label '{"query":"mutation {productVariantDelete(id: \"gid://shopify/ProductVariant/', Locked = true; - RemoveVariantEndTok: Label '\") {deletedProductVariantId userErrors{field message}}}"}', Locked = true; - GetVariantsTok: Label 'variants(first:200){pageInfo{hasNextPage} edges{cursor node{legacyResourceId updatedAt}}}', Locked = true; - - GraphQLCmdTxt: Label '/graphql.json', Locked = true; - begin - case HttpRequestMessage.Method of - 'POST': - begin - Uri := HttpRequestMessage.GetRequestUri(); - if Uri.EndsWith(GraphQLCmdTxt) then - if HttpRequestMessage.Content.ReadAs(GraphQlQuery) then - case true of - GraphQlQuery.StartsWith(CreateItemVariantTok): - HttpResponseMessage := GetCreatedVariantResponse(); - GraphQlQuery.StartsWith(GetOptionsStartTok) and GraphQlQuery.EndsWith(GetOptionsEndTok): - if MultipleOptions then - HttpResponseMessage := GetProductMultipleOptionsResponse() - else - HttpResponseMessage := GetProductOptionsResponse(); - GraphQlQuery.StartsWith(RemoveVariantStartTok) and GraphQlQuery.EndsWith(RemoveVariantEndTok): - begin - HttpResponseMessage := GetRemoveVariantResponse(); - GraphQueryTxt := GraphQlQuery; - end; - GraphQlQuery.Contains(GetVariantsTok): - HttpResponseMessage := GetDefaultVariantResponse(); - end; - end; - end; - end; - - local procedure GetCreatedVariantResponse(): HttpResponseMessage; - var - Any: Codeunit Any; - HttpResponseMessage: HttpResponseMessage; - BodyTxt: Text; - begin - Any.SetDefaultSeed(); - NewVariantId := Any.IntegerInRange(100000, 999999); - BodyTxt := StrSubstNo('{ "data": { "productVariantCreate": { "legacyResourceId": %1 } } }', NewVariantId); - HttpResponseMessage.Content.WriteFrom(BodyTxt); - exit(HttpResponseMessage); - end; - - local procedure GetProductOptionsResponse(): HttpResponseMessage - var - HttpResponseMessage: HttpResponseMessage; - BodyTxt: Text; - begin - BodyTxt := '{"data": {"product": {"id": "gid://shopify/Product/123456", "title": "Product 1", "options": [{"id": "gid://shopify/ProductOption/1", "name": "Option 1"}]}}}'; - HttpResponseMessage.Content.WriteFrom(BodyTxt); - exit(HttpResponseMessage); - end; - - local procedure GetRemoveVariantResponse(): HttpResponseMessage - var - HttpResponseMessage: HttpResponseMessage; - BodyTxt: Text; - begin - BodyTxt := '{}'; - HttpResponseMessage.Content.WriteFrom(BodyTxt); - exit(HttpResponseMessage); - end; - - local procedure GetProductMultipleOptionsResponse(): HttpResponseMessage - var - HttpResponseMessage: HttpResponseMessage; - BodyTxt: Text; - begin - BodyTxt := '{"data": {"product": {"id": "gid://shopify/Product/123456", "title": "Product 1", "options": [{"id": "gid://shopify/ProductOption/1", "name": "Option 1"}, {"id": "gid://shopify/ProductOption/2", "name": "Option 2"}]}}}'; - HttpResponseMessage.Content.WriteFrom(BodyTxt); - exit(HttpResponseMessage); - end; - - local procedure GetDefaultVariantResponse(): HttpResponseMessage - var - HttpResponseMessage: HttpResponseMessage; - BodyTxt: Text; - begin - BodyTxt := StrSubstNo('{ "data" : { "product" : { "variants" : { "edges" : [ { "node" : { "legacyResourceId" : %1 } } ] } } } }', DefaultVariantId); - HttpResponseMessage.Content.WriteFrom(BodyTxt); - exit(HttpResponseMessage); - end; - - procedure GetNewVariantId(): BigInteger - begin - exit(NewVariantId); - end; - - procedure GetGraphQueryTxt(): Text - begin - exit(GraphQueryTxt); - end; - - procedure SetMultipleOptions(NewMultipleOptions: Boolean) - begin - this.MultipleOptions := NewMultipleOptions; - end; - - procedure SetDefaultVariantId(NewDefaultVariantId: BigInteger) - begin - this.DefaultVariantId := NewDefaultVariantId; - end; -} \ No newline at end of file diff --git a/Apps/W1/Shopify/test/Products/ShpfyCreateItemVariantTest.Codeunit.al b/Apps/W1/Shopify/test/Products/ShpfyCreateItemVariantTest.Codeunit.al deleted file mode 100644 index 77761494a0..0000000000 --- a/Apps/W1/Shopify/test/Products/ShpfyCreateItemVariantTest.Codeunit.al +++ /dev/null @@ -1,206 +0,0 @@ -codeunit 139619 "Shpfy Create Item Variant Test" -{ - Subtype = Test; - TestPermissions = Disabled; - - var - Shop: Record "Shpfy Shop"; - Any: Codeunit Any; - LibraryAssert: Codeunit "Library Assert"; - ShpfyInitializeTest: Codeunit "Shpfy Initialize Test"; - IsInitialized: Boolean; - - trigger OnRun() - begin - IsInitialized := false; - end; - - [Test] - procedure UnitTestCreateVariantFromItem() - var - Item: Record "Item"; - ShpfyVariant: Record "Shpfy Variant"; - ShpfyProduct: Record "Shpfy Product"; - ShpfyProductInitTest: Codeunit "Shpfy Product Init Test"; - CreateItemAsVariant: Codeunit "Shpfy Create Item As Variant"; - CreateItemAsVariantSub: Codeunit "Shpfy CreateItemAsVariantSub"; - ParentProductId: BigInteger; - VariantId: BigInteger; - begin - // [SCENARIO] Create a variant from a given item - Initialize(); - - // [GIVEN] Item - Item := ShpfyProductInitTest.CreateItem(Shop."Item Templ. Code", Any.DecimalInRange(10, 100, 2), Any.DecimalInRange(100, 500, 2)); - // [GIVEN] Shopify product - ParentProductId := CreateShopifyProduct(Item.SystemId); - - // [WHEN] Invoke CreateItemAsVariant.CreateVariantFromItem - BindSubscription(CreateItemAsVariantSub); - CreateItemAsVariant.SetParentProduct(ParentProductId); - CreateItemAsVariant.CreateVariantFromItem(Item); - VariantId := CreateItemAsVariantSub.GetNewVariantId(); - UnbindSubscription(CreateItemAsVariantSub); - - // [THEN] Variant is created - LibraryAssert.IsTrue(ShpfyVariant.Get(VariantId), 'Variant not created'); - LibraryAssert.AreEqual(Item."No.", ShpfyVariant.Title, 'Title not set'); - LibraryAssert.AreEqual(Item."No.", ShpfyVariant."Option 1 Value", 'Option 1 Value not set'); - LibraryAssert.AreEqual('Variant', ShpfyVariant."Option 1 Name", 'Option 1 Name not set'); - LibraryAssert.AreEqual(ParentProductId, ShpfyVariant."Product Id", 'Parent product not set'); - LibraryAssert.IsTrue(ShpfyProduct.Get(ParentProductId), 'Parent product not found'); - LibraryAssert.IsTrue(ShpfyProduct."Has Variants", 'Has Variants not set'); - end; - - [Test] - procedure UnitTestGetProductOptions() - var - Item: Record "Item"; - ShpfyProductInitTest: Codeunit "Shpfy Product Init Test"; - ProductAPI: Codeunit "Shpfy Product API"; - CreateItemAsVariantSub: Codeunit "Shpfy CreateItemAsVariantSub"; - ProductId: BigInteger; - Options: Dictionary of [Text, Text]; - begin - // [SCENARIO] Get product options for a given shopify product - Initialize(); - - // [GIVEN] Item - Item := ShpfyProductInitTest.CreateItem(Shop."Item Templ. Code", Any.DecimalInRange(10, 100, 2), Any.DecimalInRange(100, 500, 2)); - // [GIVEN] Shopify product - ProductId := Any.IntegerInRange(10000, 99999); - - // [WHEN] Invoke ProductAPI.GetProductOptions - BindSubscription(CreateItemAsVariantSub); - Options := ProductAPI.GetProductOptions(ProductId); - UnbindSubscription(CreateItemAsVariantSub); - - // [THEN] Options are returned - LibraryAssert.AreEqual(1, Options.Count(), 'Options not returned'); - end; - - [Test] - procedure UnitTestDeleteProductVariant() - var - CreateItemAsVariantSub: Codeunit "Shpfy CreateItemAsVariantSub"; - VariantAPI: Codeunit "Shpfy Variant API"; - VariantId: BigInteger; - ActualQueryTxt: Text; - begin - // [SCENARIO] Delete a product variant - Initialize(); - - // [GIVEN] Shopify Variant Id - VariantId := Any.IntegerInRange(10000, 99999); - - // [WHEN] Invoke ProductAPI.DeleteProductVariant - BindSubscription(CreateItemAsVariantSub); - VariantAPI.DeleteProductVariant(VariantId); - ActualQueryTxt := CreateItemAsVariantSub.GetGraphQueryTxt(); - UnbindSubscription(CreateItemAsVariantSub); - - // [THEN] Query is correct - LibraryAssert.IsTrue(ActualQueryTxt.Contains('{"query":"mutation {productVariantDelete('), 'Query not correct'); - LibraryAssert.IsTrue(ActualQueryTxt.Contains(StrSubstNo('id: \"gid://shopify/ProductVariant/%1\"', VariantId)), 'Variant Id not set'); - end; - - [Test] - procedure UnitTestCreateVariantFromProductWithMultipleOptions() - var - Item: Record "Item"; - ShpfyProductInitTest: Codeunit "Shpfy Product Init Test"; - CreateItemAsVariant: Codeunit "Shpfy Create Item As Variant"; - CreateItemAsVariantSub: Codeunit "Shpfy CreateItemAsVariantSub"; - ProductId: BigInteger; - begin - // [SCENARIO] Create a variant from a product with multiple options - Initialize(); - - // [GIVEN] Item - Item := ShpfyProductInitTest.CreateItem(Shop."Item Templ. Code", Any.DecimalInRange(10, 100, 2), Any.DecimalInRange(100, 500, 2)); - // [GIVEN] Shopify product - ProductId := CreateShopifyProduct(Item.SystemId); - - // [GIVEN] Multiple options for the product in Shopify - CreateItemAsVariantSub.SetMultipleOptions(true); - - // [WHEN] Invoke ProductAPI.CheckProductAndShopSettings - BindSubscription(CreateItemAsVariantSub); - CreateItemAsVariant.SetParentProduct(ProductId); - asserterror CreateItemAsVariant.CheckProductAndShopSettings(); - UnbindSubscription(CreateItemAsVariantSub); - - // [THEN] Error is thrown - LibraryAssert.ExpectedError('The product has more than one option. Items cannot be added as variants to a product with multiple options.'); - end; - - [Test] - procedure UnitTestRemoveDefaultVariantTest() - var - Item: Record Item; - ShpfyVariant: Record "Shpfy Variant"; - ShpfyProductInitTest: Codeunit "Shpfy Product Init Test"; - CreateItemAsVariant: Codeunit "Shpfy Create Item As Variant"; - CreateItemAsVariantSub: Codeunit "Shpfy CreateItemAsVariantSub"; - ProductId, VariantId : BigInteger; - begin - // [SCENARIO] Remove default variant - Initialize(); - - // [GIVEN] Item - Item := ShpfyProductInitTest.CreateItem(Shop."Item Templ. Code", Any.DecimalInRange(10, 100, 2), Any.DecimalInRange(100, 500, 2)); - // [GIVEN] Shopify product - ProductId := CreateShopifyProduct(Item.SystemId); - // [GIVEN] Shopify variant - VariantId := CreateShopifyVariant(ProductId); - // [GIVEN] Default variant exists in Shopify - CreateItemAsVariantSub.SetDefaultVariantId(VariantId); - - // [WHEN] Invoke CreateItemAsVariant.RemoveDefaultVariant - BindSubscription(CreateItemAsVariantSub); - CreateItemAsVariant.SetParentProduct(ProductId); - CreateItemAsVariant.FindDefaultVariantId(); - CreateItemAsVariant.CreateVariantFromItem(Item); - CreateItemAsVariant.RemoveDefaultVariant(); - UnbindSubscription(CreateItemAsVariantSub); - - // [THEN] Default variant is removed - ShpfyVariant.SetRange(Id, VariantId); - LibraryAssert.IsTrue(ShpfyVariant.IsEmpty(), 'Default variant not removed'); - - end; - - local procedure Initialize() - begin - Any.SetDefaultSeed(); - if IsInitialized then - exit; - Shop := ShpfyInitializeTest.CreateShop(); - Commit(); - IsInitialized := true; - end; - - local procedure CreateShopifyProduct(SystemId: Guid): BigInteger - var - ShopifyProduct: Record "Shpfy Product"; - begin - ShopifyProduct.Init(); - ShopifyProduct.Id := Any.IntegerInRange(10000, 99999); - ShopifyProduct."Shop Code" := Shop."Code"; - ShopifyProduct."Item SystemId" := SystemId; - ShopifyProduct.Insert(true); - exit(ShopifyProduct."Id"); - end; - - local procedure CreateShopifyVariant(ProductId: BigInteger): BigInteger - var - ShpfyVariant: Record "Shpfy Variant"; - begin - ShpfyVariant.Init(); - ShpfyVariant.Id := Any.IntegerInRange(10000, 99999); - ShpfyVariant."Shop Code" := Shop."Code"; - ShpfyVariant."Product Id" := ProductId; - ShpfyVariant.Insert(false); - exit(ShpfyVariant."Id"); - end; -} diff --git a/Apps/W1/Shopify/test/Shipping/ShpfyShippingHelper.Codeunit.al b/Apps/W1/Shopify/test/Shipping/ShpfyShippingHelper.Codeunit.al index e10cfceb43..59871a6b88 100644 --- a/Apps/W1/Shopify/test/Shipping/ShpfyShippingHelper.Codeunit.al +++ b/Apps/W1/Shopify/test/Shipping/ShpfyShippingHelper.Codeunit.al @@ -1,4 +1,4 @@ -codeunit 139614 "Shpfy Shipping Helper" +codeunit 139559 "Shpfy Shipping Helper" { internal procedure CreateRandomShopifyOrder(LocationId: BigInteger; DeliveryMethodType: Enum "Shpfy Delivery Method Type"): BigInteger var diff --git a/Apps/W1/Shopify/test/app.json b/Apps/W1/Shopify/test/app.json index b12dfca8c5..dd320ed499 100644 --- a/Apps/W1/Shopify/test/app.json +++ b/Apps/W1/Shopify/test/app.json @@ -52,14 +52,14 @@ "screenshots": [], "platform": "26.0.0.0", "idRanges": [ - { - "from": 139560, - "to": 139574 - }, { "from": 139541, "to": 139549 }, + { + "from": 139559, + "to": 139574 + }, { "from": 139576, "to": 139589