Extract NL customization to object extensions (TrMode)#8933
Extract NL customization to object extensions (TrMode)#8933Alexander-Ya wants to merge 1 commit into
Conversation
|
Fixes AB#640601 |
|
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' |
|
|
||
| var | ||
| Text1000000: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.'; | ||
| } |
There was a problem hiding this comment.
Label 'Text1000000' has no approved suffix and is missing a Comment for its three placeholders.
The label is passed to Error() so it must end with the 'Err' suffix (AA0074). Its three placeholders (%1 = FieldCaption('Transaction Mode Code'), %2 = FieldCaption('Account Type'), %3 = FieldCaption('Bal. Account Type')) also require a Comment parameter (AA0470). Rename the label to 'Text1000000Err' and add the Comment, then update the Error() call site to match.
| } | |
| Text1000000Err: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.', Comment = '%1 = Field Caption (Transaction Mode Code), %2 = Field Caption (Account Type), %3 = Field Caption (Bal. Account Type)'; |
Knowledge:
- microsoft/knowledge/style/label-suffix-approved-list.md
- microsoft/knowledge/style/label-comment-explains-placeholders.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| } | ||
|
|
||
| var | ||
| Text1000001: Label 'It is not allowed to specify %1 when %2 is %3.'; |
There was a problem hiding this comment.
Label 'Text1000001' has no approved suffix and is missing a Comment for its three placeholders.
The label is passed to Error() so it must end with the 'Err' suffix (AA0074). Its three placeholders (%1 = Field Caption 'Currency Euro', %2 = Field Caption 'Local Currency', %3 = the option value) also require a Comment parameter (AA0470) so translators can identify each slot. Rename the label to 'Text1000001Err' and add the Comment, then update the Error() call site to match.
| Text1000001: Label 'It is not allowed to specify %1 when %2 is %3.'; | |
| Text1000001Err: Label 'It is not allowed to specify %1 when %2 is %3.', Comment = '%1 = Field Caption (Currency Euro), %2 = Field Caption (Local Currency), %3 = Local Currency value'; |
Knowledge:
- microsoft/knowledge/style/label-suffix-approved-list.md
- microsoft/knowledge/style/label-comment-explains-placeholders.md
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| end; | ||
|
|
||
| var | ||
| Text001: Label 'must be 0 if %1 is %2'; |
There was a problem hiding this comment.
Labels 'MustBe0Lbl', 'MustBeOddLbl', and 'MustBeEvenLbl' carry the 'Lbl' suffix, which is reserved for captions and tooltips, but all three are used as the error-description argument to FieldError() — an error-producing call.
Per the label-suffix guidance, labels consumed in error contexts must use the 'Err' suffix. Rename them to 'MustBe0Err', 'MustBeOddErr', and 'MustBeEvenErr', and update the six FieldError() call sites accordingly.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| TransactionMode: Record "Transaction Mode"; | ||
| AccountType: Option Customer,Vendor,Employee; | ||
| begin | ||
| if not TransactionMode.CheckTransactionModePartnerType(AccountType::Vendor, "Transaction Mode Code", "Partner Type") then |
There was a problem hiding this comment.
Label 'PartnerTypeMismatchMsg' uses the 'Msg' suffix, which is reserved for Message() calls, but the label is passed to Confirm().
Per the label-suffix guidance, labels consumed by Confirm() or StrMenu must use the 'Qst' suffix. Note that the parallel label in CustomerNL.TableExt.al is already correctly named 'PartnerTypeMismatchQst'. Rename this label to 'PartnerTypeMismatchQst' and update its Confirm() call site.
| if not TransactionMode.CheckTransactionModePartnerType(AccountType::Vendor, "Transaction Mode Code", "Partner Type") then | |
| PartnerTypeMismatchQst: Label 'The Partner Type does not match the Partner Type defined in Transaction Mode. Do you still want to change the Partner Type?'; |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| VendBankAcc: Record "Vendor Bank Account"; | ||
| IsHandled: Boolean; | ||
| begin | ||
| IsHandled := false; |
There was a problem hiding this comment.
Confirm() is called with a StrSubstNo-wrapped format string: 'Confirm(StrSubstNo(UpdateBankAccountsQst, UseFieldCaption))'.
The AL platform's Confirm() accepts a format string and variable arguments directly — wrapping with StrSubstNo hides the placeholder from analyzers and breaks the translation link. Replace with 'Confirm(UpdateBankAccountsQst, false, UseFieldCaption)', passing false as the default-button argument and the caption as the format argument.
| IsHandled := false; | |
| if not Confirm(UpdateBankAccountsQst, false, UseFieldCaption) then |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
There was a problem hiding this comment.
Code suggestion is off. Addressing issue in #8930.
| CustBankAcc: Record "Customer Bank Account"; | ||
| IsHandled: Boolean; | ||
| begin | ||
| IsHandled := false; |
There was a problem hiding this comment.
Confirm() is called with a StrSubstNo-wrapped format string: 'Confirm(StrSubstNo(UpdateBankAccountsQst, UseFieldCaption))'.
The AL platform's Confirm() accepts a format string and variable arguments directly — wrapping with StrSubstNo hides the placeholder from analyzers and breaks the translation link. Replace with 'Confirm(UpdateBankAccountsQst, false, UseFieldCaption)', passing false as the default-button argument and the caption as the format argument.
| IsHandled := false; | |
| if not Confirm(UpdateBankAccountsQst, false, UseFieldCaption) then |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
There was a problem hiding this comment.
Code suggestion is off. Addressing issue in #8930.
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 6 knowledge-backed · 0 agent findings. Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
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>
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