Implement business activity code to EU from Italy localization - #10233
Implement business activity code to EU from Italy localization#10233Alexander Yakunin (Alexander-Ya) wants to merge 7 commits into
Conversation
…Implement-Business-Activity-Code-from-IT
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
| BusinessActivityValidator.Validate(Code); | ||
| end; | ||
|
|
||
| [IntegrationEvent(false, false)] |
There was a problem hiding this comment.
The new integration event OnGetValidator (codeunit "Business Activity Code Mgt.") does not encode its firing position or host routine per the publisher-naming convention, so a subscriber cannot tell from the symbol name where/when it fires relative to Validate(). Consider a position-encoding name such as OnValidateOnBeforeGetBusinessActivityValidator or similar.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
|
|
||
| fields | ||
| { | ||
| field(1; Code; Code[10]) |
There was a problem hiding this comment.
New table 395 "Business Activity" declares DataClassification = CustomerContent at table scope but leaves both Normal fields (Code and Description) without their own field-level DataClassification. AS0016 requires the field-level property regardless of the table-level default.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
field(1; Code; Code[10])
{
Caption = 'Code';
DataClassification = CustomerContent;
NotBlank = true;
trigger OnValidate()
var
BusinessActivityCodeMgt: Codeunit "Business Activity Code Mgt.";
begin
BusinessActivityCodeMgt.Validate(Code);
end;
}
field(2; Description; Text[100])
{
Caption = 'Description';
DataClassification = CustomerContent;
}Knowledge:
- microsoft/knowledge/privacy/table-level-data-classification-cascades.md
- microsoft/knowledge/privacy/data-classification-required-on-pii-fields.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| SetBrandColorValue(); | ||
| end; | ||
| } | ||
| field(395; "Business Activity Code"; Code[10]) |
There was a problem hiding this comment.
157 new "Business Activity Code" fields added across changed table/tableextension objects omit an explicit DataClassification (for example Company Information, Purchase Header, Gen. Journal Line). AS0016 requires every Normal field to declare its own DataClassification; relying on the table-level DataClassification leaves these fields effectively unclassified for AppSourceCop/privacy tooling purposes.
Knowledge:
- microsoft/knowledge/privacy/data-classification-required-on-pii-fields.md
- microsoft/knowledge/privacy/table-level-data-classification-cascades.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| UpgradeTag.SetUpgradeTag(UpgradeTagDefinitions.GetBusinessActivityCodeUpgradeTag()); | ||
| end; | ||
|
|
||
| local procedure CopyBusinessActivityCodeField(TableId: Integer; ActivityCodeFieldId: Integer) |
There was a problem hiding this comment.
IT's UpgradeBusinessActivityCodes() calls CopyBusinessActivityCodeField(TableId, ActivityCodeFieldId) for 25 tables, and the helper hard-codes the destination field number to 12189 (DataTransfer.AddFieldValue(ActivityCodeFieldId, 12189)). Only "Periodic VAT Settlement Entry" actually defines field 12189 as "Business Activity Code". Verified: "General Ledger Setup", "VAT Setup", "VAT Statement Line", and "VAT Statement Name" do not define field 12189 at all in this diff (their new field is 395, and for VAT Setup/Statement Line/Name it isn't even the same field: 395 there is "Per Business Activity Code Settl. Entry" (Boolean) or "Business Activity Code Filter", not a plain code copy target). Calling DataTransfer.CopyFields() against a nonexistent destination field 12189 will fail at runtime for these tables, breaking the IT upgrade path; the remaining ~20 tables that do use field 395 for "Business Activity Code" will silently copy into field 12189 (also nonexistent there), so no upgraded company gets its data migrated into the real field 395.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| begin | ||
| if Code = '' then | ||
| exit; | ||
|
|
There was a problem hiding this comment.
The new publisher OnGetValidator (internal IntegrationEvent in Business Activity Code Mgt.) uses an ad-hoc name that doesn't encode its position relative to the host procedure Validate, so subscribers cannot tell from the name alone that it fires before dispatch/validation. Rename the publisher (and its IT event subscriber) to an OnBefore.../OnAfter... shape that reflects where it fires within Validate.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| Editable = false; | ||
| FieldClass = FlowField; | ||
| } | ||
| field(395; "Business Activity Code"; Code[10]) |
There was a problem hiding this comment.
The PR adds roughly 150+ new 'Business Activity Code' (Code[10]) fields across W1 and country-layer journal, document, archive, history, VAT, and company tables (for example src/Layers/W1/BaseApp/Sales/Document/SalesHeader.Table.al, .../Purchases/Document/PurchaseHeader.Table.al, and .../Finance/GeneralLedger/Journal/GenJournalLine.Table.al) without a DataClassification property. These fields default to ToBeClassified, leaving new business/customer data unreviewed for GDPR/telemetry purposes across dozens of shipped tables in one PR.
Knowledge:
- microsoft/knowledge/privacy/data-classification-required-on-pii-fields.md
- microsoft/knowledge/privacy/table-level-data-classification-cascades.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
|
The changed file src/Layers/IT/BaseApp/Permissions/local.permissionset.al does not follow the ..al convention: both the object segment (local) and the type segment (permissionset) are lower-cased, hurting discoverability by tooling. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
|
The changed file src/Layers/IT/BaseApp/Permissions/localread.permissionset.al does not follow the ..al convention: both the object segment (localread) and the type segment (permissionset) are lower-cased. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
|
The changed file src/Layers/IT/BaseApp/Service/Local/History/ServiceInvoiceHeaderIT.tableExt.al uses a lower-cased type suffix (tableExt) instead of the canonical TableExt segment required by the ..al pattern. Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
|
|
||
| codeunit 12102 "Business Activity Code Mgt." | ||
| { | ||
| procedure Validate(Code: Code[10]) |
There was a problem hiding this comment.
The new 'Business Activity Code Mgt.' codeunit exposes a public Validate procedure without XML documentation. Add ///
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
Co-authored-by: Alexander-Ya <179119309+Alexander-Ya@users.noreply.github.com>
…://github.com/microsoft/BCApps into bugs/Implement-Business-Activity-Code-from-IT
|
Table 12136 "Periodic VAT Settlement Entry" adds the replacement field "Business Activity Code", but the shipped field 1 "Activity Code" remains live with no ObsoleteState, ObsoleteReason, or ObsoleteTag. Keep the original field readable and mark it Pending so dependent extensions get the standard deprecation window before CLEAN29 cleanup. Suggested fix (apply manually — could not be anchored as a one-click suggestion): field(1; "Activity Code"; Code[6])
{
Caption = 'Activity Code';
ObsoleteReason = 'Replaced by the Business Activity Code field.';
ObsoleteState = Pending;
ObsoleteTag = '29.0';
}Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
| field(12189; "Business Activity Code"; Code[10]) | ||
| { | ||
| Caption = 'Business Activity Code'; | ||
| } |
There was a problem hiding this comment.
The new "Business Activity Code" field on "Periodic VAT Settlement Entry" lacks TableRelation = "Business Activity".Code even though every other new "Business Activity Code" field in this PR carries that relation. This drops lookup/validation for the field and allows codes that do not exist in table 395.
| field(12189; "Business Activity Code"; Code[10]) | |
| { | |
| Caption = 'Business Activity Code'; | |
| } | |
| field(12189; "Business Activity Code"; Code[10]) | |
| { | |
| Caption = 'Business Activity Code'; | |
| TableRelation = "Business Activity".Code; | |
| } |
Agent judgement — not directly backed by a BCQuality knowledge article.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| Editable = false; | ||
| FieldClass = FlowField; | ||
| } | ||
| field(395; "Business Activity Code"; Code[10]) |
There was a problem hiding this comment.
The PR adds 179 new Normal "Business Activity Code" fields across changed tables/tableextensions without a field-level DataClassification, relying on table scope instead. BCQuality's AS0016 guidance requires every Normal field to declare DataClassification explicitly rather than inheriting it from the table.
Knowledge:
- microsoft/knowledge/privacy/table-level-data-classification-cascades.md
- microsoft/knowledge/privacy/data-classification-required-on-pii-fields.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| end; | ||
|
|
||
| #if not CLEAN29 | ||
| local procedure UpgradeBusinessActivityCodes() |
There was a problem hiding this comment.
UpgradeBusinessActivityCodes() introduces a one-time migration that creates Business Activity rows and bulk-copies the new field into many tables, but it emits no Session.LogMessage telemetry before setting the upgrade tag, leaving no upgrade-time observability for whether it ran and how much data it moved. Add explicit upgrade telemetry for this procedure (at minimum a stable event id plus success/skip/failure context and migrated row counts) before the upgrade tag is set.
Agent judgement — not directly backed by a BCQuality knowledge article.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
| end; | ||
|
|
||
| #if not CLEAN29 | ||
| local procedure UpgradeBusinessActivityCodes() |
There was a problem hiding this comment.
The new validator paths are exercised in src/Layers/IT/Tests/Local/ITActivityCode.Codeunit.al, but this PR also adds UpgradeBusinessActivityCodes() plus 24 CopyBusinessActivityCodeField() migrations and none of the changed test files seeds legacy Activity Code data or verifies that the upgrade both creates Business Activity rows and copies old field values into the new Business Activity Code fields. Add an upgrade test that runs the upgrade against pre-upgrade data and asserts both the table migration and the DataTransfer-based field copy — this would also have caught the field-id mismatch bug found elsewhere in this review.
Agent judgement — not directly backed by a BCQuality knowledge article.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
What & why
Linked work
Fixes #
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
Risk & compatibility