From cb4a2a0213bb7fe0e55a4e386f662293e0b3e472 Mon Sep 17 00:00:00 2001 From: jaymckinney-enavate <99509805+jaymckinney-enavate@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:00:22 -0500 Subject: [PATCH] GP - Correct issue with IRS 1099 data migration (#27784) This change corrects an issue when migrating GP Vendor 1099 data on version v25. Changes: - Always check to see if the new IRS Forms feature is enabled. - Initialize the original/old IRS 1099 Forms feature if required. Fixes #26487 Fixes [AB#560225](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/560225) --------- Co-authored-by: jaymckinney Co-authored-by: Jesper Schulz-Wedde --- .../Codeunits/GPCloudMigrationUS.Codeunit.al | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Apps/US/HybridGP_US/app/src/Codeunits/GPCloudMigrationUS.Codeunit.al b/Apps/US/HybridGP_US/app/src/Codeunits/GPCloudMigrationUS.Codeunit.al index 5f11fabab8..3c0f713e07 100644 --- a/Apps/US/HybridGP_US/app/src/Codeunits/GPCloudMigrationUS.Codeunit.al +++ b/Apps/US/HybridGP_US/app/src/Codeunits/GPCloudMigrationUS.Codeunit.al @@ -1,17 +1,17 @@ namespace Microsoft.DataMigration.GP; using System.Integration; -#if not CLEAN25 using System.Environment.Configuration; +#if not CLEAN25 +using Microsoft.Finance.VAT.Reporting; #endif using Microsoft.Purchases.Vendor; + codeunit 42004 "GP Cloud Migration US" { var -#if not CLEAN25 IRSFormFeatureKeyIdTok: Label 'IRSForm', Locked = true; -#endif [EventSubscriber(ObjectType::Codeunit, CodeUnit::"Data Migration Mgt.", 'OnAfterMigrationFinished', '', false, false)] local procedure OnAfterMigrationFinishedSubscriber(var DataMigrationStatus: Record "Data Migration Status"; WasAborted: Boolean; StartTime: DateTime; Retry: Boolean) @@ -31,6 +31,9 @@ codeunit 42004 "GP Cloud Migration US" begin if GPCompanyAdditionalSettings.GetMigrateVendor1099Enabled() then begin EnsureSupportedReportingYear(); +#if not CLEAN25 + EnsureOriginalIRS1099FeatureInitializedIfNeeded(); +#endif SetupIRSFormsFeatureIfNeeded(); BindSubscription(GPPopulateVendor1099Data); GPPopulateVendor1099Data.Run(); @@ -73,17 +76,10 @@ codeunit 42004 "GP Cloud Migration US" internal procedure IsIRSFormsFeatureEnabled(): Boolean var -#if not CLEAN25 FeatureManagementFacade: Codeunit "Feature Management Facade"; -#endif IsEnabled: Boolean; begin - IsEnabled := true; - -#if not CLEAN25 IsEnabled := FeatureManagementFacade.IsEnabled(IRSFormFeatureKeyIdTok); -#endif - exit(IsEnabled); end; @@ -101,4 +97,18 @@ codeunit 42004 "GP Cloud Migration US" GPIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear); end; + +#if not CLEAN25 + local procedure EnsureOriginalIRS1099FeatureInitializedIfNeeded() + var +#pragma warning disable AL0432 + IRS1099FormBox: Record "IRS 1099 Form-Box"; +#pragma warning restore AL0432 + begin + if IsIRSFormsFeatureEnabled() then + exit; + + IRS1099FormBox.InitIRS1099FormBoxes(); + end; +#endif } \ No newline at end of file