-
Notifications
You must be signed in to change notification settings - Fork 430
[main] features 640066 Add integration events for events for CZ Adv. Payment and CZ Cash Desk #10079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[main] features 640066 Add integration events for events for CZ Adv. Payment and CZ Cash Desk #10079
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,16 +202,20 @@ codeunit 11725 "Cash Document-Release CZP" | |
| local procedure CheckMandatoryFields(CashDocumentHeaderCZP: Record "Cash Document Header CZP") | ||
| var | ||
| SkipPaymentPurposeTestField: Boolean; | ||
| SkipAmountsTestFields: Boolean; | ||
| begin | ||
| SkipPaymentPurposeTestField := false; | ||
| OnBeforeCheckMandatoryFields(CashDocumentHeaderCZP, SkipPaymentPurposeTestField); | ||
| SkipAmountsTestFields := false; | ||
| OnBeforeCheckMandatoryFields(CashDocumentHeaderCZP, SkipPaymentPurposeTestField, SkipAmountsTestFields); | ||
|
|
||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."No."); | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Posting Date"); | ||
| CashDocumentHeaderCZP.VATRounding(); | ||
| CashDocumentHeaderCZP.CalcFields(CashDocumentHeaderCZP."Amount Including VAT", CashDocumentHeaderCZP."Amount Including VAT (LCY)"); | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT"); | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT (LCY)"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new SkipAmountsTestFields extension point lets a subscriber skip the two TestField checks on the Amount Including VAT FlowFields, but CalcFields for both FlowFields still runs unconditionally beforehand. When SkipAmountsTestFields is set true, this performs a database-backed FlowField recalculation whose result is now never used. Move CalcFields inside the Suggested fix (apply manually — could not be anchored as a one-click suggestion): CashDocumentHeaderCZP.VATRounding();
if not SkipAmountsTestFields then begin
CashDocumentHeaderCZP.CalcFields(CashDocumentHeaderCZP."Amount Including VAT", CashDocumentHeaderCZP."Amount Including VAT (LCY)");
CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT");
CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT (LCY)");
end;👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4 |
||
| if not SkipAmountsTestFields then begin | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT"); | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Amount Including VAT (LCY)"); | ||
| end; | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Document Date"); | ||
| if not SkipPaymentPurposeTestField then | ||
| CashDocumentHeaderCZP.TestField(CashDocumentHeaderCZP."Payment Purpose"); | ||
|
|
@@ -373,7 +377,7 @@ codeunit 11725 "Cash Document-Release CZP" | |
| end; | ||
|
|
||
| [IntegrationEvent(false, false)] | ||
| local procedure OnBeforeCheckMandatoryFields(CashDocumentHeaderCZP: Record "Cash Document Header CZP"; var SkipPaymentPurposeTestField: Boolean) | ||
| local procedure OnBeforeCheckMandatoryFields(CashDocumentHeaderCZP: Record "Cash Document Header CZP"; var SkipPaymentPurposeTestField: Boolean; var SkipAmountsTestFields: Boolean) | ||
| begin | ||
| end; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new OnBeforeValidateAdvanceLetterNoCZZ IsHandled hook wraps the entire OnValidate trigger of "Advance Letter No. CZZ", so a subscriber that sets IsHandled := true silently skips all referential and consistency validation below it: the Gen. Document Type payment check, the Document Type/Account Type case validation, the Get()/TestField() cross-checks against the sales/purchase advance letter header (Bill-to Customer No./Pay-to Vendor No., Currency Code), and the Amount/Dimension Set ID defaulting. Per BCQuality guidance, IsHandled should scope only a safe, side-effect-free value calculation - critical referential-integrity validation should run unconditionally, or be exposed via a separate OnAfter... event, not be bypassable via IsHandled.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4