mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
* Add lifecycle error and privacy knowledge Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec * Fix lifecycle privacy review findings Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a26cd6d6-ff49-433e-bc53-f645c455ebdd * Refine lifecycle privacy retrieval Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec * Make review gates explicit Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec --------- Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
63 lines
1.7 KiB
AL
63 lines
1.7 KiB
AL
codeunit 50302 "Upgrade Phases Good"
|
|
{
|
|
Subtype = Upgrade;
|
|
|
|
trigger OnCheckPreconditionsPerCompany()
|
|
begin
|
|
CheckTargetPostingGroup();
|
|
end;
|
|
|
|
trigger OnUpgradePerCompany()
|
|
var
|
|
UpgradeTag: Codeunit "Upgrade Tag";
|
|
begin
|
|
if UpgradeTag.HasUpgradeTag(CustomerPostingGroupTag()) then
|
|
exit;
|
|
|
|
MigrateCustomerPostingGroups();
|
|
UpgradeTag.SetUpgradeTag(CustomerPostingGroupTag());
|
|
end;
|
|
|
|
trigger OnValidateUpgradePerCompany()
|
|
begin
|
|
CheckLegacyPostingGroupsRemoved();
|
|
end;
|
|
|
|
local procedure CheckTargetPostingGroup()
|
|
var
|
|
CustomerPostingGroup: Record "Customer Posting Group";
|
|
begin
|
|
if not CustomerPostingGroup.Get('NEW') then
|
|
Error(TargetGroupMissingErr);
|
|
end;
|
|
|
|
local procedure MigrateCustomerPostingGroups()
|
|
var
|
|
Customer: Record Customer;
|
|
begin
|
|
Customer.SetRange("Customer Posting Group", 'OLD');
|
|
if Customer.FindSet(true) then
|
|
repeat
|
|
Customer.Validate("Customer Posting Group", 'NEW');
|
|
Customer.Modify(true);
|
|
until Customer.Next() = 0;
|
|
end;
|
|
|
|
local procedure CheckLegacyPostingGroupsRemoved()
|
|
var
|
|
Customer: Record Customer;
|
|
begin
|
|
Customer.SetRange("Customer Posting Group", 'OLD');
|
|
if not Customer.IsEmpty() then
|
|
Error(MigrationIncompleteErr);
|
|
end;
|
|
|
|
local procedure CustomerPostingGroupTag(): Code[250]
|
|
begin
|
|
exit('MS-50302-CustomerPostingGroup-20260714');
|
|
end;
|
|
|
|
var
|
|
MigrationIncompleteErr: Label 'The legacy customer posting group was not migrated.';
|
|
TargetGroupMissingErr: Label 'Customer posting group NEW must exist before the upgrade.';
|
|
}
|