Extract NL customization to object extensions (TrMode)#8933
Extract NL customization to object extensions (TrMode)#8933Alexander-Ya wants to merge 31 commits into
Conversation
|
Fixes AB#640601 |
Copilot PR ReviewIteration 17 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 3 knowledge-backed · 0 agent findings. Orchestrator pre-filter (2 file(s) excluded)
Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives. |
The model-reported anchor for a single-line suggestion can be off by more than 8 lines (e.g. PR #8933 VendorNL Confirm() was off by 10, label rename off by 9). Widen the search window to 40 lines either side so the correct target within the same procedure is considered, while the 0.5 similarity floor and 0.1 ambiguity margin keep an unrelated look-alike from winning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Widening the search window exposed a precision problem: a label-rename suggestion whose added Comment text echoes the field captions at the Error()/Confirm() call site would re-anchor onto the call site (PR #8933 GenJournalLineNL/GeneralLedgerSetupNL 'Text1000000/1' findings), which is worse than the original mis-anchor. Raise the similarity floor to 0.6 and use a bounded window (20). Genuine edit targets - an edited statement or a renamed declaration - score ~0.75-0.99 and re-anchor confidently (the PR #8933 Confirm() findings and the PartnerTypeMismatchMsg->Qst rename now land on the right line). Lower- confidence look-alikes stay below the floor and are suppressed, so the caller posts a manual snippet instead of a wrong auto-applicable anchor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Extract-NL-customization-to-object-extensions-v2
…Extract-NL-customization-to-object-extensions-v2
This comment was marked as resolved.
This comment was marked as resolved.
| Access = Internal; | ||
|
|
||
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post Prepayments", 'OnBeforePostCustomerEntry', '', false, false)] | ||
| local procedure OnBeforePostCustomerEntry(var GenJnlLine: Record "Gen. Journal Line"; SalesHeader: Record "Sales Header") |
There was a problem hiding this comment.
The new EventSubscriber OnBeforePostCustomerEntry on Codeunit::"Sales-Post Prepayments" is declared with only two parameters, `(var GenJnlLine: Record "Gen.
Journal Line"; SalesHeader: Record "Sales Header"), but the publisher (SalesPostPrepayments.Codeunit.al line 2431) declares six parameters: (var GenJnlLine: Record "Gen. Journal Line"; TotalPrepmtInvLineBuffer: Record "Prepayment Inv. Line Buffer"; TotalPrepmtInvLineBufferLCY: Record "Prepayment Inv. Line Buffer"; CommitIsSuppressed: Boolean; SalesHeader: Record "Sales Header"; DocumentType: Option Invoice,"Credit Memo")`. A subscriber cannot cherry-pick a subset of the publisher's parameters; the full parameter list, in order, must be reproduced. As written this subscriber will not bind to the publisher and the extracted NL Transaction Mode Code/Bank Account Code logic that used to run inline in the old NL override of Sales-Post Prepayments will silently stop firing.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| @@ -7581,7 +7582,7 @@ table 36 "Sales Header" | |||
| if ReplaceVATDate then | |||
| "VAT Reporting Date" := VATDateReq; | |||
|
|
|||
| if ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin | |||
| if ReplacePostingDate and ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
…Extract-NL-customization-to-object-extensions-v2
| } | ||
| } | ||
|
|
||
| procedure UpdateElecTaxDeclCategoryCode() |
There was a problem hiding this comment.
VATStatementLineNL.TableExt widens UpdateElecTaxDeclCategoryCode from a local procedure in the original full-object NL override to a public tableextension procedure, but it is only invoked from the companion VATStatementLineNL.Codeunit.al within the same app.
Publishing it needlessly turns an internal helper into an external contract that must now be preserved across future refactors.
| procedure UpdateElecTaxDeclCategoryCode() | |
| internal procedure UpdateElecTaxDeclCategoryCode() |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| UpdateBankAccountsQst: Label 'Do you want to update the bank accounts for this customer to reflect the new value of %1?', Comment = '%1 = Field Caption'; | ||
| PartnerTypeMismatchQst: Label 'The Partner Type does not match the Partner Type defined in Transaction Mode. Do you still want to change the Partner Type?'; | ||
|
|
||
| [Scope('OnPrem')] |
There was a problem hiding this comment.
CustomerNL.TableExt widens UpdateCustomerBankAccounts from a local procedure in the original full-object NL override to a published, non-local procedure marked only with [Scope('OnPrem')], even though every call site remains inside the same tableextension.
That turns an implementation detail into a supported API surface for no functional reason, freezing a contract that was never meant to be external.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
[Scope('OnPrem')]
local procedure UpdateCustomerBankAccounts(UseFieldCaption: Text[250])Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
…Extract-NL-customization-to-object-extensions-v2
| { | ||
| addafter("Industrial Classification") | ||
| { | ||
| field("Fiscal Entity No."; Rec."Fiscal Entity No.") |
There was a problem hiding this comment.
The new namespaced NL layer repeatedly adds unaffixed members to standard objects, for example field(11400; "Cash Journal"; ...) in src/Layers/NL/BaseApp/Local/Foundation/AuditCodes/SourceCodeSetupNL.TableExt.al:14, field("Fiscal Entity No."; ...) in src/Layers/NL/BaseApp/Local/Foundation/Company/CompanyInformationNL.PageExt.al:13, and action("Post Code Updates") in src/Layers/NL/BaseApp/Local/RoleCenters/AdministratorMainRCNL.PageExt.al:15. A two-level namespace only replaces the owned object affix; fields, controls, and actions added to base objects still need the registered member affix.
Knowledge:
- microsoft/knowledge/appsource/two-level-namespace-replaces-object-affix-not-extension-member-affix.md
- microsoft/knowledge/appsource/object-affixes-prevent-collisions.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4
|
The public IntegrationEvent Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4 |
| end; | ||
| } | ||
| field(11000002; "Currency Euro"; Code[10]) | ||
| { |
There was a problem hiding this comment.
The Currency Euro OnValidate path dead-ends with a plain Error even though the code already knows the immediate
Recommendation:
- when Local Currency is Euro, Currency Euro must be cleared. Raise an ErrorInfo with a Fix-it action so the user can apply the correction in one step instead of dismissing a blocking dialog.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4
| } | ||
|
|
||
| var | ||
| TransactionModeAccountTypeErrorQst: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.', Comment = '%1 - Field Caption of the field causing the error, %2 - Field Caption of the Account Type field, %3 - Field Caption of the Bal. Account Type field'; |
There was a problem hiding this comment.
The validation error text on GenJournalLineNL.TableExt.al says Transaction Mode Code is allowed only for Customer or Vendor, but the surrounding TableRelation and lookup logic also accept Employee. Update the message so users who hit this error are told the real set of supported account types.
| TransactionModeAccountTypeErrorQst: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.', Comment = '%1 - Field Caption of the field causing the error, %2 - Field Caption of the Account Type field, %3 - Field Caption of the Bal. Account Type field'; | |
| TransactionModeAccountTypeErrorQst: Label '%1 can only be filled in when %2 %3 is equal to Customer, Vendor, or Employee.', Comment = '%1 - Field Caption of the field causing the error, %2 - Field Caption of the Account Type field, %3 - Field Caption of the Bal. Account Type field'; |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4
|
The touched Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4 |
|
|
||
| tableextension 11382 "G/L Entry NL" extends "G/L Entry" | ||
| { | ||
| fields |
There was a problem hiding this comment.
src/Layers/NL/BaseApp/Local/Finance/GeneralLedger/Ledger/GLEntryNL.TableExt.al reintroduces field 11301 Open (moved verbatim, including its InitValue = true, from the base G/L Entry table which had the same field removed in this diff) as a new tableextension field, but the NL upgrade work added in this PR only registers upgrade tags for Local SEPA Instr. Priority and Elec. Tax Declaration Setup. Moving a field's ownership from a base table to a table extension does not automatically carry over existing row values; without a tagged upgrade step, pre-upgrade G/L Entry rows will read back the Boolean default false instead of their real historical Open value.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4
| UnapplyVendorLedgerEntryAmount(''); // Currency as blank. | ||
| end; | ||
|
|
||
| [Test] |
There was a problem hiding this comment.
Why do you remove the test?
There was a problem hiding this comment.
All-E already reverted this change, so after sybc these tests and their earlier fix will dissappear anyway. I did it earlier myself to identify if this is the last issue with tests or I have smething else.
https://github.com/microsoft/BCApps into bugs/Extract-NL-customization-to-object-extensions-v2
| /// Defines country-specific VAT registration number formats for validation and duplicate checking. | ||
| /// Provides pattern matching capabilities and business rules enforcement for VAT numbers across different jurisdictions. | ||
| /// </summary> | ||
| codeunit 13381 "VAT Reg. No. Format NL" |
There was a problem hiding this comment.
Three new NL localization codeunits are declared without Access = Internal;, unlike every one of the other ~19 new NL event-subscriber codeunits added in this PR (e.g. "Employee NL", "Sales Header NL", "Customer NL"), which all consistently set it. "VAT Reg. No. Format NL" (codeunit 13381), "VAT Statement Line NL" (codeunit 11366), and "Company Information NL" (codeunit 11361) contain only local event-subscriber procedures with no intended external entry point, so leaving them without an access modifier makes them default-public and reachable from other extensions, turning implementation detail into an accidental contract.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
codeunit 13381 "VAT Reg. No. Format NL"
{
Access = Internal;Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.15.4
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.Finance.VAT.Reporting; | ||
|
|
||
| codeunit 11366 "VAT Statement Line NL" |
There was a problem hiding this comment.
Same missing Access = Internal; inconsistency as codeunit 13381 "VAT Reg. No. Format NL": this codeunit contains only a local event-subscriber procedure and should be internal like its sibling NL codeunits.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
codeunit 11366 "VAT Statement Line NL"
{
Access = Internal;Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.15.4
|
|
||
| using Microsoft.Utilities; | ||
|
|
||
| codeunit 11361 "Company Information NL" |
There was a problem hiding this comment.
Same missing Access = Internal; inconsistency as codeunit 13381 "VAT Reg. No. Format NL": this codeunit contains only a local event-subscriber procedure and should be internal like its sibling NL codeunits.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
codeunit 11361 "Company Information NL"
{
Access = Internal;Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.15.4
What & why
Linked work
Fixes AB#640601
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
Risk & compatibility