Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions build/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,22 @@
}
]
},
{
"name": "Depreciation Differences FI",
"groups": [
{
"name": "LocalBaseExtensions"
}
]
},
{
"name": "Depreciation Differences FI Tests",
"groups": [
{
"name": "LocalBaseExtensions"
}
]
},
{
"name": "DK Core",
"groups": [
Expand Down
22 changes: 22 additions & 0 deletions build/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,28 @@
"ruleSetPathMinorRelease": "$ENV:INETROOT\\App\\Rulesets\\MinorRelease\\app.ruleset.json",
"owningteam": "\\AI Business Solutions\\Finance"
},
"Depreciation Differences FI": {
"projectPath": "$env:INETROOT\\App\\Apps\\FI\\DepreciationDifferencesFI\\app",
"dvdFolder": "Applications\\DepreciationDifferencesFI\\Source",
"hasTranslations": true,
"installOnEnvironmentUpdate": true,
"supportedCountries": "FI",
"runStaticCodeAnalysis": true,
"logLevel": "warning",
"ruleSetPath": "$ENV:INETROOT\\App\\Rulesets\\app.ruleset.json",
"ruleSetPathMinorRelease": "$ENV:INETROOT\\App\\Rulesets\\MinorRelease\\app.ruleset.json"
},
"Depreciation Differences FI Tests": {
"projectPath": "$env:INETROOT\\App\\Apps\\FI\\DepreciationDifferencesFI\\test",
"dvdFolder": "Applications\\DepreciationDifferencesFI\\Test",
"supportedCountries": "FI",
"isTest": true,
"runStaticCodeAnalysis": true,
"logLevel": "warning",
"ruleSetPath": "$ENV:INETROOT\\App\\Rulesets\\app.ruleset.json",
"ruleSetPathMinorRelease": "$ENV:INETROOT\\App\\Rulesets\\MinorRelease\\app.ruleset.json",
"owningteam": "\\AI Business Solutions\\Finance"
},
"DK Core": {
"projectPath": "$env:INETROOT\\App\\Apps\\DK\\DKCore\\app",
"dvdFolder": "Applications\\DKCore\\Source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Microsoft.DemoData.FixedAsset;

using Microsoft.DemoData.Finance;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.FixedAsset;

codeunit 13445 "Create FA Posting Grp. FI"
Expand All @@ -32,8 +33,21 @@ codeunit 13445 "Create FA Posting Grp. FI"
end;

local procedure ValidateRecordFields(var FAPostingGroup: Record "FA Posting Group"; DeprDifferenceAcc: Code[20]; DeprDifferenceBalAcc: Code[20])
#if not CLEAN29
var
DepreciationDifferencesFIFeature: Codeunit "Depreciation Differences FI Feature";
#endif
begin
FAPostingGroup.Validate("Depr. Difference Acc.", DeprDifferenceAcc);
FAPostingGroup.Validate("Depr. Difference Bal. Acc.", DeprDifferenceBalAcc);
#if not CLEAN29
if not DepreciationDifferencesFIFeature.IsEnabled() then begin
#pragma warning disable AL0432
FAPostingGroup.Validate("Depr. Difference Acc.", DeprDifferenceAcc);
FAPostingGroup.Validate("Depr. Difference Bal. Acc.", DeprDifferenceBalAcc);
#pragma warning restore AL0432
exit;
end;
#endif
FAPostingGroup.Validate("Depreciation Difference Account", DeprDifferenceAcc);
FAPostingGroup.Validate("Depreciation Difference Bal Acct", DeprDifferenceBalAcc);
end;
}
6 changes: 6 additions & 0 deletions src/Apps/FI/ContosoCoffeeDemoDatasetFI/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"name": "Contoso Coffee Demo Dataset",
"publisher": "Microsoft",
"version": "29.0.0.0"
},
{
"id": "ecb1100e-3081-4c6a-9554-de33c687bf5f",
"name": "Depreciation Differences FI",
"publisher": "Microsoft",
"version": "$(app_currentVersion)"
}
],
"screenshots": [],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/Apps/FI/DepreciationDifferencesFI/app/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"id": "ecb1100e-3081-4c6a-9554-de33c687bf5f",
"name": "Depreciation Differences FI",
"publisher": "Microsoft",
"version": "$(app_currentVersion)",
"brief": "First-party app for FI depreciation differences in Business Central.",
"description": "Implements Finnish posting depreciation differences functionality in Business Central.",
"privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
"EULA": "https://go.microsoft.com/fwlink/?linkid=2009120",
"help": "https://go.microsoft.com/fwlink/?linkid=2212316",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"logo": "ExtensionLogo.png",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2212316",
"application": "$(app_minimumVersion)",
"platform": "$(app_platformVersion)",
"dependencies": [],
"internalsVisibleTo": [
{
"id": "a6ac48f2-7b89-47fe-bb24-a9f722e6fec0",
"name": "Depreciation Differences FI Tests",
"publisher": "Microsoft"
}
],
"screenshots": [],
"target": "OnPrem",
"idRanges": [
{
"from": 13462,
"to": 13485
}
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"features": [
"NoImplicitWith",
"TranslationFile"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace Microsoft.FixedAssets.Depreciation;

permissionsetextension 13485 "Dep Diff FI - Objects" extends "D365 BASIC"
{
Permissions =
tabledata "Depr. Diff. Posting Buffer" = RIMD,
table "Depr. Diff. Posting Buffer" = X,
report "Calc. and Post Depr. Diff." = X,
codeunit "Depreciation Differences FI Subscribers" = X,
#if not CLEAN29
codeunit "Depreciation Differences FI Feature" = X,
codeunit "Dep Diff FI Feature Data Update" = X,
#endif
#if CLEAN29
codeunit "Upgrade Depreciation Diff. FI" = X,
#endif
codeunit "Dep Diff FI Upgrade Tag" = X;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#if not CLEAN29
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace Microsoft.FixedAssets.Depreciation;

using Microsoft.Foundation.Navigate;
using System.Environment.Configuration;
using System.Upgrade;

codeunit 13468 "Dep Diff FI Feature Data Update" implements "Feature Data Update"
{
Access = Internal;
Permissions = tabledata "Feature Data Update Status" = rm;
InherentEntitlements = X;
InherentPermissions = X;
ObsoleteReason = 'Feature Depreciation Differences FI will be enabled by default in version 32.0.';
ObsoleteState = Pending;
ObsoleteTag = '29.0';

var
TempDocumentEntry: Record "Document Entry" temporary;
DescriptionTxt: Label 'Existing records in FI BaseApp fields will be copied to Depreciation Differences FI app fields.';

procedure IsDataUpdateRequired(): Boolean
begin
CountRecords();
if TempDocumentEntry.IsEmpty() then begin
SetUpgradeTag(false);
exit(false);
end;
exit(true);
end;

procedure ReviewData()
var
DataUpgradeOverview: Page "Data Upgrade Overview";
begin
Commit();
Clear(DataUpgradeOverview);
DataUpgradeOverview.Set(TempDocumentEntry);
DataUpgradeOverview.RunModal();
end;

procedure AfterUpdate(FeatureDataUpdateStatus: Record "Feature Data Update Status")
var
UpdateFeatureDataUpdateStatus: Record "Feature Data Update Status";
begin
UpdateFeatureDataUpdateStatus.SetRange("Feature Key", FeatureDataUpdateStatus."Feature Key");
UpdateFeatureDataUpdateStatus.SetFilter("Company Name", '<>%1', FeatureDataUpdateStatus."Company Name");
UpdateFeatureDataUpdateStatus.ModifyAll("Feature Status", FeatureDataUpdateStatus."Feature Status");
SetUpgradeTag(true);
end;

procedure UpdateData(FeatureDataUpdateStatus: Record "Feature Data Update Status")
var
FeatureDataUpdateMgt: Codeunit "Feature Data Update Mgt.";
StartDateTime: DateTime;
EndDateTime: DateTime;
begin
StartDateTime := CurrentDateTime;
FeatureDataUpdateMgt.LogTask(FeatureDataUpdateStatus, 'Upgrade Depreciation Differences FI', StartDateTime);
TransferFields(Database::"FA Posting Group", 13462, 13400);
TransferFields(Database::"FA Posting Group", 13463, 13401);
TransferFields(Database::"FA Ledger Entry", 13464, 13400);
TransferFields(Database::"Source Code Setup", 13465, 13400);
EndDateTime := CurrentDateTime;
FeatureDataUpdateMgt.LogTask(FeatureDataUpdateStatus, 'Upgrade Depreciation Differences FI', EndDateTime);
end;

procedure GetTaskDescription() TaskDescription: Text
begin
TaskDescription := DescriptionTxt;
end;

local procedure CountRecords()
begin
TempDocumentEntry.Reset();
TempDocumentEntry.DeleteAll();
InsertDocumentEntry(Database::"FA Posting Group", 'FA Posting Group', CountWithNonDefaultField(Database::"FA Posting Group", 13400, false) + CountWithNonDefaultField(Database::"FA Posting Group", 13401, false));
InsertDocumentEntry(Database::"FA Ledger Entry", 'FA Ledger Entry', CountWithNonDefaultField(Database::"FA Ledger Entry", 13400, true));
InsertDocumentEntry(Database::"Source Code Setup", 'Source Code Setup', CountWithNonDefaultField(Database::"Source Code Setup", 13400, false));
end;

local procedure CountWithNonDefaultField(TableId: Integer; SourceFieldNo: Integer; BooleanField: Boolean): Integer
var
RecRef: RecordRef;
SourceFieldRef: FieldRef;
begin
RecRef.Open(TableId, false);
SourceFieldRef := RecRef.Field(SourceFieldNo);
if BooleanField then
SourceFieldRef.SetFilter('%1', true)
else
SourceFieldRef.SetFilter('<>%1', '');
exit(RecRef.Count());
end;

local procedure InsertDocumentEntry(TableID: Integer; TableName: Text; RecordCount: Integer)
begin
if RecordCount = 0 then
exit;
TempDocumentEntry.Init();
TempDocumentEntry."Entry No." += 1;
TempDocumentEntry."Table ID" := TableID;
TempDocumentEntry."Table Name" := CopyStr(TableName, 1, MaxStrLen(TempDocumentEntry."Table Name"));
TempDocumentEntry."No. of Records" := RecordCount;
TempDocumentEntry.Insert();
end;

local procedure TransferFields(TableId: Integer; TargetFieldNo: Integer; SourceFieldNo: Integer)
var
RecRef: RecordRef;
TargetFieldRef: FieldRef;
SourceFieldRef: FieldRef;
begin
RecRef.Open(TableId, false);
SourceFieldRef := RecRef.Field(SourceFieldNo);
if RecRef.FindSet() then
repeat
TargetFieldRef := RecRef.Field(TargetFieldNo);
TargetFieldRef.Value := SourceFieldRef.Value;
RecRef.Modify(false);
until RecRef.Next() = 0;
end;

local procedure SetUpgradeTag(DataUpgradeExecuted: Boolean)
var
UpgradeTag: Codeunit "Upgrade Tag";
DepreciationDifferencesFIUpgradeTag: Codeunit "Dep Diff FI Upgrade Tag";
begin
if UpgradeTag.HasUpgradeTag(DepreciationDifferencesFIUpgradeTag.GetUpgradeTag()) then
exit;
UpgradeTag.SetUpgradeTag(DepreciationDifferencesFIUpgradeTag.GetUpgradeTag());
if not DataUpgradeExecuted then
UpgradeTag.SetSkippedUpgrade(DepreciationDifferencesFIUpgradeTag.GetUpgradeTag(), true);
end;
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace Microsoft.FixedAssets.Depreciation;

using System.Upgrade;

codeunit 13476 "Dep Diff FI Upgrade Tag"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Upgrade Tag", OnGetPerCompanyUpgradeTags, '', false, false)]
local procedure OnGetPerCompanyUpgradeTags(var PerCompanyUpgradeTags: List of [Code[250]])
begin
PerCompanyUpgradeTags.Add(GetUpgradeTag());
end;

procedure GetUpgradeTag(): Code[250]
begin
exit('MS-DepreciationDifferencesFIUpgradeTag-20260711');
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#if not CLEAN29
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace Microsoft.FixedAssets.Depreciation;

using System.Environment.Configuration;

codeunit 13466 "Depreciation Differences FI Feature"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;

var
FeatureKeyIdTok: Label 'DepreciationDifferencesFI', Locked = true;

procedure IsEnabled() Enabled: Boolean
var
FeatureManagementFacade: Codeunit "Feature Management Facade";
begin
Enabled := FeatureManagementFacade.IsEnabled(FeatureKeyIdTok);
OnAfterCheckFeatureEnabled(Enabled);
end;

procedure GetFeatureKeyId(): Text
begin
exit(FeatureKeyIdTok);
end;

[IntegrationEvent(true, false)]
local procedure OnAfterCheckFeatureEnabled(var IsEnabled: Boolean)
begin
end;
}
#endif
Loading
Loading