diff --git a/src/Apps/W1/Subscription Billing/Test/Billing/AutomatedBillingTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Billing/AutomatedBillingTest.Codeunit.al index 226b3fb05f..0d8dd2aaad 100644 --- a/src/Apps/W1/Subscription Billing/Test/Billing/AutomatedBillingTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Billing/AutomatedBillingTest.Codeunit.al @@ -77,6 +77,7 @@ codeunit 148455 "Automated Billing Test" var CustomerSubscriptionContract: Record "Customer Subscription Contract"; SubscriptionHeader: Record "Subscription Header"; + SubscriptionLine: Record "Subscription Line"; BillingTemplate: Record "Billing Template"; BillingLine: Record "Billing Line"; SalesHeader: Record "Sales Header"; @@ -87,8 +88,16 @@ codeunit 148455 "Automated Billing Test" // [GIVEN] A Billing Template with automation settings CreateBillingTemplateWithAutomation(BillingTemplate); - // [WHEN] Bill the contracts automatically + // [GIVEN] A contract with subscription lines starting today ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, ''); + SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No."); + SubscriptionLine.FindSet(); + repeat + SubscriptionLine.Validate("Subscription Line Start Date", Today()); + SubscriptionLine.Modify(true); + until SubscriptionLine.Next() = 0; + + // [WHEN] Bill the contracts automatically BillingTemplate.BillContractsAutomatically(); // [THEN] Verify that Sales Header is created for the billed contract @@ -118,8 +127,15 @@ codeunit 148455 "Automated Billing Test" CreateBillingTemplateWithAutomation(BillingTemplate); ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, ''); - // [GIVEN]Remove Item UOM to cause error during billing + // [GIVEN] Subscription lines starting today SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No."); + SubscriptionLine.FindSet(); + repeat + SubscriptionLine.Validate("Subscription Line Start Date", Today()); + SubscriptionLine.Modify(true); + until SubscriptionLine.Next() = 0; + + // [GIVEN] Remove Item UOM to cause error during billing SubscriptionLine.FindLast(); ItemUnitOfMeasure.Get(SubscriptionLine."Invoicing Item No.", SubscriptionHeader."Unit of Measure"); ItemUnitOfMeasure.Delete(); diff --git a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingDocsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingDocsTest.Codeunit.al index 194870f5f6..7bb6d9e50f 100644 --- a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingDocsTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingDocsTest.Codeunit.al @@ -1294,7 +1294,7 @@ codeunit 139687 "Recurring Billing Docs Test" end; [Test] - [HandlerFunctions('MessageHandler,GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler,ExchangeRateSelectionModalPageHandler')] + [HandlerFunctions('GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler')] procedure GetVendorContractLinesProducesCorrectAmountsDuringSelection() var Item: Record Item; @@ -1306,7 +1306,7 @@ codeunit 139687 "Recurring Billing Docs Test" // [GIVEN] Setup Subscription with Subscription Line and assign it to Vendor Subscription Contract // [GIVEN] Create Purchase Invoice with Purchase Invoice Line ContractTestLibrary.DeleteAllContractRecords(); - ContractTestLibrary.CreateVendor(Vendor); + ContractTestLibrary.CreateVendorInLCY(Vendor); ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); GetVendorContractServiceCommitment(VendorContract."No."); ServiceCommitment."Billing Rhythm" := ServiceCommitment."Billing Base Period"; diff --git a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al index badeab23a1..01a37e0979 100644 --- a/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al @@ -601,7 +601,6 @@ codeunit 139688 "Recurring Billing Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure CheckBillingLineUpdateRequiredOnModifyCustomerContractLine() var DiscountAmount: Decimal; @@ -611,7 +610,7 @@ codeunit 139688 "Recurring Billing Test" begin Initialize(); - ContractTestLibrary.CreateCustomer(Customer); + ContractTestLibrary.CreateCustomerInLCY(Customer); ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Customer); BillingLine.Reset(); @@ -656,7 +655,6 @@ codeunit 139688 "Recurring Billing Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure CheckBillingLineUpdateRequiredOnModifyVendorContractLine() var DiscountAmount: Decimal; @@ -666,7 +664,7 @@ codeunit 139688 "Recurring Billing Test" begin Initialize(); - ContractTestLibrary.CreateVendor(Vendor); + ContractTestLibrary.CreateVendorInLCY(Vendor); ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Vendor); BillingLine.Reset(); diff --git a/src/Apps/W1/Subscription Billing/Test/Contract Renewal/ContractRenewalTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Contract Renewal/ContractRenewalTest.Codeunit.al index c33f04aaa2..6112bd6b50 100644 --- a/src/Apps/W1/Subscription Billing/Test/Contract Renewal/ContractRenewalTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Contract Renewal/ContractRenewalTest.Codeunit.al @@ -674,6 +674,8 @@ codeunit 139692 "Contract Renewal Test" Initialize(); // [GIVEN] We Create all the needed data CreateBaseData(); + CustomerContract.Validate("Currency Code", ''); + CustomerContract.Modify(false); BaseCalculationPercentage := LibraryRandom.RandDecInDecimalRange(80, 100, 2); CalculationBaseAmount := LibraryRandom.RandDecInDecimalRange(80, 100, 2); // [WHEN] We run the action Contract Renewal Quote and change the values on Subscription, values are tested in a ContractRenewalSelectionModalPageHandler diff --git a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al index 7ec5d08b4a..ef05808dcd 100644 --- a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al @@ -75,7 +75,6 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure CheckContractLineTypeForCommentOnCustomerContractLine() var Customer: Record Customer; @@ -89,7 +88,7 @@ codeunit 148155 "Contracts Test" // [SCENARIO] Create Customer Subscription Contract. Add Description and check if the ContractLineType for that line is Comment Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); CreateCustomerContractSetup(Customer, ServiceObject, CustomerContract); DescriptionText := LibraryRandom.RandText(100); @@ -220,7 +219,7 @@ codeunit 148155 "Contracts Test" begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ServCommWOCustContract.OpenEdit(); ServiceCommitment.Reset(); @@ -235,7 +234,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ServCommWOCustContractPageHandler,ExchangeRateSelectionModalPageHandler,MessageHandler')] + [HandlerFunctions('ServCommWOCustContractPageHandler')] procedure CheckServiceCommitmentAssignmentToCustomerContractForServiceObjectWithItem() var Customer: Record Customer; @@ -249,7 +248,7 @@ codeunit 148155 "Contracts Test" // [SCENARIO] Check that proper Subscription Lines are assigned to Customer Subscription Contract Lines Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); @@ -321,7 +320,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ServCommWOCustContractPageHandler,ExchangeRateSelectionModalPageHandler,MessageHandler')] + [HandlerFunctions('ServCommWOCustContractPageHandler')] procedure CheckServiceCommitmentAssignmentToCustomerContractWithShipToCode() var Customer: Record Customer; @@ -335,8 +334,8 @@ codeunit 148155 "Contracts Test" // [SCENARIO] Check that proper Subscription Lines are assigned to Customer Subscription Contract Lines Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject2, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject2, false, false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); ShipToAddress.SetRange("Customer No.", Customer."No."); ShipToAddress.FindFirst(); @@ -371,7 +370,7 @@ codeunit 148155 "Contracts Test" Initialize(); Currency.InitRoundingPrecision(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, true); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); CustomerContractPage.OpenEdit(); @@ -455,7 +454,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,ConfirmHandlerYes,MessageHandler')] + [HandlerFunctions('ConfirmHandlerYes,MessageHandler')] procedure CheckValueChangesOnCustomerContractLines() var ItemVariant: Record "Item Variant"; @@ -479,7 +478,7 @@ codeunit 148155 "Contracts Test" // [SCENARIO] Assign Subscription Lines to Customer Subscription Contract Lines. Change values on Customer Subscription Contract Lines and check that Subscription Line has changed values. Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); Currency.InitRoundingPrecision(); CreateCustomerContractSetup(Customer, ServiceObject, CustomerContract); @@ -592,7 +591,7 @@ codeunit 148155 "Contracts Test" begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); LibrarySales.CreateShipToAddress(ShipToAddress, Customer."No."); @@ -785,7 +784,6 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('MessageHandler,ExchangeRateSelectionModalPageHandler')] procedure ExpectErrorForWrongServiceCommitmentToCustomerContractAssignment() var Customer: Record Customer; @@ -798,7 +796,7 @@ codeunit 148155 "Contracts Test" // [SCENARIO] try to assign Subscription Line to wrong Contract No (different Customer No.) Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); ContractTestLibrary.CreateCustomer(Customer2); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer2."No."); @@ -824,7 +822,7 @@ codeunit 148155 "Contracts Test" begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, true); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -1030,7 +1028,6 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure ExpectNoClosedCustomerContractLines() var Customer: Record Customer; @@ -1042,7 +1039,7 @@ codeunit 148155 "Contracts Test" begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); ContractTestLibrary.InsertCustomerContractCommentLine(CustomerContract, CustomerContractLine2); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -1264,7 +1261,7 @@ codeunit 148155 "Contracts Test" // [GIVEN] ContractAnalysisEntry.DeleteAll(false); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, true); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, true, true); ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler // [WHEN] @@ -1425,7 +1422,6 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure TestDeleteServiceCommitmentLinkedToContractLineNotClosed() var Customer: Record Customer; @@ -1437,8 +1433,8 @@ codeunit 148155 "Contracts Test" // Test: Subscription Line cannot be deleted if an open contract line exists Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); - ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); + ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); ServiceCommitment.Reset(); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -1451,7 +1447,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler,ConfirmHandlerYes')] + [HandlerFunctions('ConfirmHandlerYes')] procedure TestDeleteServiceCommitmentLinkedToContractLineIsClosed() var Customer: Record Customer; @@ -1463,8 +1459,8 @@ codeunit 148155 "Contracts Test" // Test: A closed Contract Line is deleted when deleting the Subscription Line Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); - ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); + ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); ServiceCommitment.Reset(); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -1630,7 +1626,7 @@ codeunit 148155 "Contracts Test" Initialize(); Currency.InitRoundingPrecision(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, true); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); CustomerContractPage.OpenEdit(); @@ -1648,7 +1644,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ServCommWOCustContractPageHandler,ExchangeRateSelectionModalPageHandler,MessageHandler')] + [HandlerFunctions('ServCommWOCustContractPageHandler')] procedure TestResetServiceCommitmentsOnCurrencyCodeDelete() var Currency: Record Currency; @@ -1661,7 +1657,7 @@ codeunit 148155 "Contracts Test" Initialize(); Currency.InitRoundingPrecision(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); CustomerContractPage.OpenEdit(); @@ -1703,7 +1699,7 @@ codeunit 148155 "Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler,CreateCustomerBillingDocsContractPageHandler')] + [HandlerFunctions('MessageHandler,CreateCustomerBillingDocsContractPageHandler')] procedure UpdatingServiceDatesWillNotCloseCustomerContractLinesWhenLineIsNotInvoicedCompletely() var Customer: Record Customer; @@ -1716,10 +1712,10 @@ codeunit 148155 "Contracts Test" // [SCENARIO] Test if the Customer Subscription Contract line will be closed in case of different constellations Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, false, false); // [GIVEN] Create a Customer Subscription Contract with Subscription Lines - ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler + ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No."); ContractTestLibrary.InsertCustomerContractCommentLine(CustomerContract, CustomerContractLine2); // [GIVEN] Make sure that Subscription Line End Date is filled, to fullfil the requirement for close of the Customer Subscription Contract line @@ -2162,7 +2158,7 @@ codeunit 148155 "Contracts Test" ServiceCommitment.Modify(false); end; - local procedure SetupServiceObjectForNewItemWithServiceCommitment(var Customer: Record Customer; var ServiceObject: Record "Subscription Header"; SNSpecificTracking: Boolean; AddVendorServiceCommitment: Boolean) + local procedure SetupServiceObjectForNewItemWithServiceCommitment(var Customer: Record Customer; var ServiceObject: Record "Subscription Header"; SNSpecificTracking: Boolean; AddVendorServiceCommitment: Boolean; CustomerWithCurrency: Boolean) var Item: Record Item; ItemServCommitmentPackage: Record "Item Subscription Package"; @@ -2171,7 +2167,10 @@ codeunit 148155 "Contracts Test" ServiceCommitmentTemplate: Record "Sub. Package Line Template"; ServiceCommitmentTemplate2: Record "Sub. Package Line Template"; begin - ContractTestLibrary.CreateCustomer(Customer); + if CustomerWithCurrency then + ContractTestLibrary.CreateCustomer(Customer) + else + ContractTestLibrary.CreateCustomerInLCY(Customer); ContractTestLibrary.CreateServiceObjectForItem(ServiceObject, Item, SNSpecificTracking); ServiceObject.Validate("End-User Customer Name", Customer.Name); ServiceObject.Modify(false); @@ -2219,9 +2218,9 @@ codeunit 148155 "Contracts Test" ServiceObject.InsertServiceCommitmentsFromServCommPackage(WorkDate(), ServiceCommitmentPackage); end; - local procedure SetupServiceObjectForNewItemWithServiceCommitment(var Customer: Record Customer; var ServiceObject: Record "Subscription Header"; SNSpecificTracking: Boolean) + local procedure SetupServiceObjectForNewItemWithServiceCommitment(var Customer: Record Customer; var ServiceObject: Record "Subscription Header"; SNSpecificTracking: Boolean; CustomerWithCurrency: Boolean) begin - SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, SNSpecificTracking, false); + SetupServiceObjectForNewItemWithServiceCommitment(Customer, ServiceObject, SNSpecificTracking, false, CustomerWithCurrency); end; local procedure SetupServiceObjectForNewGLAccountWithServiceCommitment(var Customer: Record Customer; var ServiceObject: Record "Subscription Header") diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractRenewalTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractRenewalTest.json deleted file mode 100644 index 12e9c5275e..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractRenewalTest.json +++ /dev/null @@ -1,98 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "TestIfContractRenewalSelectionIsUpdateOnAfterValidateCalcBasePercentage" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckAndVerifyCreateSingleSalesQuote" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckCreateMultipleContractRenewalQuotes" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckEndDateForRenewalTermDifferentThanSubsequentTerm" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckSortingInRenewalQuote" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckVatCalculationForContractRenewalServiceCommitmentRhythmInReports" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckServCommSelectionPageAcceptChanges" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "CheckSerialNoDescriptionForRenewalSalesQuoteWithSNTracking" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "ExpectErrorOnChangeQtyToShip" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "ExpectNoPostedSalesInvoiceOnPostRenewalSalesOrder" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "PostContractRenewalAndVerifyResult" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "PostModifiedContractRenewalWithFinalInvoiceAndVerifyResult" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "TestPostedDocumentsOnPostRenewalSalesOrder" - }, - { - "bug": "574501", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "TestSalesQuoteToOrderYesNoForContractRenewal" - }, - { - "bug": "603387", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "AllowSelectionOfResponsibilityCenterInContractRenewalSalesDocuments" - }, - { - "bug": "603387", - "codeunitId": 139692, - "codeunitName": "Contract Renewal Test", - "method": "PreventExistingDimensionsInContractRenewalSalesDocumentsWhenResponsibilityCenterIsChanged" - } -] diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractsTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractsTest.json deleted file mode 100644 index ce7528a094..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ContractsTest.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 148155, - "CodeunitName": "Contracts Test", - "Method": "CheckValueChangesOnCustomerContractLines" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingDocsTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingDocsTest.json deleted file mode 100644 index 45fea04443..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingDocsTest.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 139687, - "CodeunitName": "Recurring Billing Docs Test", - "Method": "GetVendorContractLinesProducesCorrectAmountsDuringSelection" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingTest.json deleted file mode 100644 index c805971b3f..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/RecurringBillingTest.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 139688, - "CodeunitName": "Recurring Billing Test", - "Method": "CheckBillingLineUpdateRequiredOnModifyCustomerContractLine" - }, - { - "bug": "597430", - "codeunitId": 139688, - "CodeunitName": "Recurring Billing Test", - "Method": "CheckBillingLineUpdateRequiredOnModifyVendorContractLine" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceCommArchiveTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceCommArchiveTest.json deleted file mode 100644 index 965b51bb75..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceCommArchiveTest.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 139916, - "CodeunitName": "Service Comm. Archive Test", - "Method": "ExpectSingleServiceCommitmentArchiveOnModifyMultipleFieldsOnCustomerContractLine" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceObjectDisabledTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceObjectDisabledTest.json deleted file mode 100644 index 3c7f14f4c8..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/ServiceObjectDisabledTest.json +++ /dev/null @@ -1,9 +0,0 @@ - -[ - { - "bug": "619916", - "codeunitId": 148157, - "codeunitName": "Service Object Test", - "method": "CheckSubscriptionLineRecalculatesTerminationDatesOnStartDateChange" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/DisabledTests/VendorContractsTest.json b/src/Apps/W1/Subscription Billing/Test/DisabledTests/VendorContractsTest.json deleted file mode 100644 index 55cdc68abf..0000000000 --- a/src/Apps/W1/Subscription Billing/Test/DisabledTests/VendorContractsTest.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "bug": "597430", - "codeunitId": 148154, - "CodeunitName": "Vendor Contracts Test", - "Method": "CheckValueChangesOnVendorContractLines" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Subscription Billing/Test/Service Commitments/ServiceCommArchiveTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Service Commitments/ServiceCommArchiveTest.Codeunit.al index 3840e79b8f..e258336ede 100644 --- a/src/Apps/W1/Subscription Billing/Test/Service Commitments/ServiceCommArchiveTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Service Commitments/ServiceCommArchiveTest.Codeunit.al @@ -84,7 +84,6 @@ codeunit 139916 "Service Comm. Archive Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure ExpectSingleServiceCommitmentArchiveOnModifyMultipleFieldsOnCustomerContractLine() var TempServiceCommitment: Record "Subscription Line" temporary; @@ -93,7 +92,7 @@ codeunit 139916 "Service Comm. Archive Test" // Expect only one Subscription Line archive if multiple fields are modified in less then a minute SetupServiceObjectWithServiceCommitment(false, false); - ContractTestLibrary.CreateCustomer(Customer); + ContractTestLibrary.CreateCustomerInLCY(Customer); ServiceObject."End-User Customer No." := Customer."No."; ServiceObject.Modify(false); ContractTestLibrary.CreateCustomerContract(CustomerContract, Customer."No."); diff --git a/src/Apps/W1/Subscription Billing/Test/Service Objects/ServiceObjectTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Service Objects/ServiceObjectTest.Codeunit.al index e732c1be38..a26281c7e0 100644 --- a/src/Apps/W1/Subscription Billing/Test/Service Objects/ServiceObjectTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Service Objects/ServiceObjectTest.Codeunit.al @@ -1862,6 +1862,7 @@ codeunit 148157 "Service Object Test" local procedure VerifySubscriptionLineDates(var SubscriptionLine: Record "Subscription Line"; StartDate: Date; InitialTerm: Text; NoticePeriod: Text) var + DateTimeManagement: Codeunit "Date Time Management"; ExpectedEndDate: Date; ExpectedTermUntil: Date; ExpectedCancellationPossibleUntil: Date; @@ -1869,6 +1870,8 @@ codeunit 148157 "Service Object Test" ExpectedEndDate := CalcDate(InitialTerm + '-1D', StartDate); ExpectedTermUntil := ExpectedEndDate; ExpectedCancellationPossibleUntil := CalcDate('-' + NoticePeriod, ExpectedTermUntil); + if DateTimeManagement.IsLastDayOfMonth(ExpectedTermUntil) then + DateTimeManagement.MoveDateToLastDayOfMonth(ExpectedCancellationPossibleUntil); SubscriptionLine.TestField("Subscription Line Start Date", StartDate); SubscriptionLine.TestField("Subscription Line End Date", ExpectedEndDate); diff --git a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al index 66d258eb82..3dadc5a2ea 100644 --- a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al +++ b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al @@ -5,7 +5,6 @@ using Microsoft.Finance.GeneralLedger.Account; using Microsoft.Inventory.Item; using Microsoft.Purchases.Document; using Microsoft.Purchases.Vendor; -using Microsoft.Sales.Customer; #pragma warning disable AA0210 codeunit 148154 "Vendor Contracts Test" @@ -22,7 +21,6 @@ codeunit 148154 "Vendor Contracts Test" ContractType: Record "Subscription Contract Type"; Currency: Record Currency; CurrExchRate: Record "Currency Exchange Rate"; - Customer: Record Customer; Item: Record Item; PurchaseHeader: Record "Purchase Header"; ServiceCommitment: Record "Subscription Line"; @@ -53,13 +51,12 @@ codeunit 148154 "Vendor Contracts Test" #region Tests [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure CheckClosedVendorContractLines() var VendorContractLine2: Record "Vend. Sub. Contract Line"; begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, false); ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler ContractTestLibrary.InsertVendorContractCommentLine(VendorContract, VendorContractLine2); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -101,14 +98,14 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ServCommWOVendContractPageHandler,ExchangeRateSelectionModalPageHandler,MessageHandler')] + [HandlerFunctions('ServCommWOVendContractPageHandler')] procedure CheckServiceCommitmentAssignmentToVendorContractForServiceObjectWithItem() var InvoicingViaNotManagedErr: Label 'Invoicing via %1 not managed', Locked = true; begin // [SCENARIO] Check that proper Subscription Lines are assigned to Vendor Subscription Contract Lines. Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, false); ContractTestLibrary.CreateVendorContract(VendorContract, Vendor."No."); VendorContractPage.OpenEdit(); @@ -178,7 +175,7 @@ codeunit 148154 "Vendor Contracts Test" procedure CheckServiceCommitmentAssignmentToVendorContractInFCY() begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, true); ContractTestLibrary.CreateVendorContract(VendorContract, Vendor."No."); VendorContractPage.OpenEdit(); @@ -223,7 +220,7 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,ConfirmHandlerYes,MessageHandler')] + [HandlerFunctions('ConfirmHandlerYes,MessageHandler')] procedure CheckValueChangesOnVendorContractLines() var OldServiceCommitment: Record "Subscription Line"; @@ -438,7 +435,7 @@ codeunit 148154 "Vendor Contracts Test" procedure ExpectErrorOnAssignServiceCommitmentsWithMultipleCurrencies() begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, true); ContractTestLibrary.CreateVendorContract(VendorContract, Vendor."No."); ServiceCommitment.Reset(); @@ -510,13 +507,12 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure ExpectNoClosedVendorContractLines() var VendorContractLine2: Record "Vend. Sub. Contract Line"; begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, false); ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); ContractTestLibrary.InsertVendorContractCommentLine(VendorContract, VendorContractLine2); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -604,14 +600,14 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler,ConfirmHandlerYes')] + [HandlerFunctions('ConfirmHandlerYes')] procedure TestDeleteServiceCommitmentLinkedToContractLineIsClosed() begin // Test: A closed Contract Line is deleted when deleting the Subscription Line Initialize(); ContractTestLibrary.DeleteAllContractRecords(); - SetupServiceObjectForNewItemWithServiceCommitment(false); - ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler + SetupServiceObjectForNewItemWithServiceCommitment(false, false); + ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); ServiceCommitment.Reset(); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -628,14 +624,13 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')] procedure TestDeleteServiceCommitmentLinkedToContractLineNotClosed() begin // Test: Subscription Line cannot be deleted if an open contract line exists Initialize(); ContractTestLibrary.DeleteAllContractRecords(); - SetupServiceObjectForNewItemWithServiceCommitment(false); - ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Customer."No."); // ExchangeRateSelectionModalPageHandler, MessageHandler + SetupServiceObjectForNewItemWithServiceCommitment(false, false); + ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); ServiceCommitment.Reset(); ServiceCommitment.SetRange("Subscription Header No.", ServiceObject."No."); @@ -653,7 +648,7 @@ codeunit 148154 "Vendor Contracts Test" begin Initialize(); ContractTestLibrary.DeleteAllContractRecords(); - ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No.", true); + ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, '', true); UpdateServiceStartDateFromVendorContractSubpage(); @@ -704,7 +699,7 @@ codeunit 148154 "Vendor Contracts Test" procedure TestRecalculateServiceCommitmentsOnChangeCurrencyCode() begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, true); ContractTestLibrary.CreateVendorContract(VendorContract, Vendor."No."); VendorContractPage.OpenEdit(); @@ -719,11 +714,11 @@ codeunit 148154 "Vendor Contracts Test" end; [Test] - [HandlerFunctions('ServCommWOVendContractPageHandler,ExchangeRateSelectionModalPageHandler,MessageHandler')] + [HandlerFunctions('ServCommWOVendContractPageHandler')] procedure TestResetServiceCommitmentsOnCurrencyCodeDelete() begin Initialize(); - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, false); ContractTestLibrary.CreateVendorContract(VendorContract, Vendor."No."); VendorContractPage.OpenEdit(); @@ -808,7 +803,7 @@ codeunit 148154 "Vendor Contracts Test" local procedure CreateVendorContractSetup() begin - SetupServiceObjectForNewItemWithServiceCommitment(false); + SetupServiceObjectForNewItemWithServiceCommitment(false, false); ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No."); end; @@ -827,18 +822,18 @@ codeunit 148154 "Vendor Contracts Test" ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, '', CreateAdditionalLine); end; - local procedure SetupServiceObjectForNewItemWithServiceCommitment(SNSpecificTracking: Boolean) + local procedure SetupServiceObjectForNewItemWithServiceCommitment(SNSpecificTracking: Boolean; VendorWithCurrency: Boolean) var ItemServCommitmentPackage: Record "Item Subscription Package"; ServiceCommPackageLine: Record "Subscription Package Line"; ServiceCommitmentPackage: Record "Subscription Package"; begin ClearAll(); - ContractTestLibrary.CreateVendor(Vendor); + if VendorWithCurrency then + ContractTestLibrary.CreateVendor(Vendor) + else + ContractTestLibrary.CreateVendorInLCY(Vendor); ContractTestLibrary.CreateServiceObjectForItem(ServiceObject, Item, SNSpecificTracking); - ServiceObject.SetHideValidationDialog(true); - ServiceObject.Validate("End-User Customer Name", Customer.Name); - ServiceObject.Modify(false); ContractTestLibrary.CreateServiceCommitmentTemplate(ServiceCommitmentTemplate); ServiceCommitmentTemplate."Calculation Base %" := LibraryRandom.RandDec(100, 2); @@ -895,10 +890,7 @@ codeunit 148154 "Vendor Contracts Test" begin ClearAll(); ContractTestLibrary.InitContractsApp(); - ContractTestLibrary.CreateCustomer(Customer); ContractTestLibrary.CreateServiceObjectForGLAccountWithServiceCommitments(ServiceObject, GLAccount, 0, 1, '<1Y>', '<1M>'); - ServiceObject.Validate("End-User Customer Name", Customer.Name); - ServiceObject.Modify(false); end; local procedure TestNewServiceObject()