Extract IT withholding tax code#9185
Conversation
|
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' |
Copilot PR ReviewIteration 4 · 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 |
| #endif | ||
| end; | ||
|
|
||
| #if not CLREAN29 |
There was a problem hiding this comment.
The obsoleted procedure 'CheckWithholdTax' in Gen.
Jnl.-Post Line is guarded by '#if not CLREAN29' — the compiler symbol is misspelled ('CLREAN29' instead of 'CLEAN29'). Every other obsolete-removal block introduced in this same PR (in this file and in PurchPost.Codeunit.al) correctly uses '#if not CLEAN29'. Because 'CLREAN29' is never a real build symbol, 'not CLREAN29' is always true, so this block will never be compiled out — not even in a CLEAN29 build — defeating the staged-removal mechanic the referenced guidance describes ('the standard mechanic for retiring the actual implementation body is to remove the #if not CLEAN block in the same release that flips the state to Removed'). The obsolete wrapper will silently survive indefinitely alongside its now-duplicated logic in 'WHT Gen. Jnl.-Post Line IT'.
| #if not CLREAN29 | |
| #if not CLEAN29 |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| Caption = 'Contribution'; | ||
| Image = "Report"; | ||
| RunObject = Report Contribution; | ||
| ToolTip = 'Get a report of social security and workers´Š¢ compensation contribution taxes on non-inventory services that you have purchased from an independent contractor or consultant.'; |
There was a problem hiding this comment.
Two role-center tooltips in this page extension contain mojibake (workers´Š¢ compensation) instead of readable text, so users will see corrupted UI copy.
Replace the corrupted characters in both tooltips with a normal apostrophe or typographic apostrophe (workers' compensation / workers' compensation).
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| codeunit 12111 "WHT Gen. Journal Line IT" | ||
| { | ||
|
|
||
| [EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAccountNoOnValidateOnBeforeCreateDim', '', true, false)] |
There was a problem hiding this comment.
The new Gen.
Journal Line subscribers for Account No. and Document Date immediately delegate to DeleteTmpWithhSocSec/UpdateTmpWithholdingContribution, which read the persistent Tmp Withholding Contribution table on every validation. This matches the anti-pattern of doing database work in frequently-fired subscribers without a cheap in-memory guard; add a fast exit so only lines that can actually have withholding state touch the table.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| } | ||
|
|
||
| var | ||
| Text12100: Label 'You cannot create the withhold entry from entry %1 because it''s an %2 Document.'; |
There was a problem hiding this comment.
Label Text12100 has two placeholders (%1, %2) but no Comment explaining them.
Translators cannot infer from the text alone that %1 is the entry number and %2 is the document type, so the label should document both placeholders explicitly.
| Text12100: Label 'You cannot create the withhold entry from entry %1 because it''s an %2 Document.'; | |
| Text12100: Label 'You cannot create the withhold entry from entry %1 because it''s an %2 Document.', Comment = '%1 = Entry No., %2 = Document Type'; |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
This PR deletes WHT-backed fields directly from existing base tables and reintroduces them in tableextensions (for example Vendor, Vendor Templ., and Gen.Journal Line) with no Pending deprecation window. That is an immediate contract break for dependent extensions that still compile against the base-table symbols; per the referenced guidance, these fields need a staged Pending → Removed lifecycle instead of disappearing in one release. Notably, other parts of this same PR (e.g. procedures in GenJnlPostLine.Codeunit.al and PurchPost.Codeunit.al) correctly wrap the moved logic in Knowledge:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
The move also removes public base-object entry points outright (
|
| end; | ||
|
|
||
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnPrepareTempVendLedgEntryOnBeforeCheckAgainstApplnCurrency', '', true, false)] | ||
| local procedure OnPrepareTempVendLedgEntryOnBeforeCheckAgainstApplnCurrency(GenJournalLine: Record "Gen. Journal Line"; OldVendorLedgerEntry: Record "Vendor Ledger Entry") |
There was a problem hiding this comment.
This subscriber does not copy the publisher signature exactly.
OnPrepareTempVendLedgEntryOnBeforeCheckAgainstApplnCurrency is published with (GenJournalLine, NewCVLedgerEntryBuffer, OldVendorLedgerEntry), but the subscriber skips the middle parameter and makes its second parameter OldVendorLedgerEntry. For event subscribers, the parameter list must match the publisher order; skipping a non-trailing parameter prevents the subscriber from binding/compiling.
| local procedure OnPrepareTempVendLedgEntryOnBeforeCheckAgainstApplnCurrency(GenJournalLine: Record "Gen. Journal Line"; OldVendorLedgerEntry: Record "Vendor Ledger Entry") | |
| local procedure OnPrepareTempVendLedgEntryOnBeforeCheckAgainstApplnCurrency(GenJournalLine: Record "Gen. Journal Line"; NewCVLedgerEntryBuffer: Record "CV Ledger Entry Buffer"; OldVendorLedgerEntry: Record "Vendor Ledger Entry") |
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| codeunit 12138 "WHT Gen. Jnl.-Post Line IT" | ||
| { | ||
| var | ||
| Text1130023: Label 'Because this invoice includes Withholding Tax, it should not be applied directly. Please use the function Payment Journals -> Payments -> Withh.Tax-Soc.Sec.'; |
There was a problem hiding this comment.
Text1130023 is passed to Error() in this codeunit, but its name has no approved suffix.
Per AA0074, error labels should use an Err suffix so the call-site contract is visible from the identifier.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| } | ||
|
|
||
| var | ||
| Text12100: Label 'You cannot create the withhold entry from entry %1 because it''s an %2 Document.'; |
There was a problem hiding this comment.
Text12100 is passed to Error() from this page extension, but its name has no approved suffix.
Per AA0074, error labels should use an Err suffix instead of a generic Text#### identifier.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", 'OnBeforeCheckPostRestrictions', '', true, false)] | ||
| local procedure OnBeforeCheckPostRestrictions(var PurchaseHeader: Record "Purchase Header"; var IsHandled: Boolean) | ||
| begin | ||
| CheckWithholdingTaxTotalAmount(PurchaseHeader); |
There was a problem hiding this comment.
This codeunit calls its own procedures as bare identifiers (CheckWithholdingTaxTotalAmount, PostWithhSocSec, GetCompWithhTaxTotalAmount) instead of this.<procedure>(...).
The this prefix is the BC style convention for explicit self-reference inside codeunits.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
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