mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-07 18:06: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
This commit is contained in:
parent
9214f73819
commit
0c2a0ceb82
25 changed files with 457 additions and 37 deletions
|
|
@ -0,0 +1,63 @@
|
|||
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.';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue