[main] bug 643971 - Implement checks for blocked customers and vendors in advance letters#9719
Open
DavidHolusa wants to merge 1 commit into
Open
[main] bug 643971 - Implement checks for blocked customers and vendors in advance letters#9719DavidHolusa wants to merge 1 commit into
DavidHolusa wants to merge 1 commit into
Conversation
Alexander-Ya
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Add blocked vendor/customer validation to advance letter headers and posting. When a vendor or customer is blocked (All, Payment for vendors; All, Ship, Invoice for customers) or privacy-blocked, the system now raises an error when:
Setting the vendor/customer on a purchase/sales advance letter header (validation).
Posting an advance letter payment (post restrictions check).
This aligns advance letter behavior with standard purchase/sales document blocking and prevents users from creating or posting advance letters for blocked parties.
Linked work
Fixes AB#643971
How I validated this
What I tested and the outcome
App changes (4 files):
CustomerCZZ.TableExt.al — added CheckBlockedCustOnAdvanceLettersCZZ(Transaction) that checks Privacy Blocked and Blocked <> " ".
VendorCZZ.TableExt.al — added CheckBlockedVendOnAdvanceLettersCZZ(Transaction) with the same logic for vendors.
SalesAdvLetterHeaderCZZ.Table.al — calls the customer check on "Bill-to Customer No." validation (Transaction=false) and in CheckSalesAdvanceLetterPostRestrictions (Transaction=true).
PurchAdvLetterHeaderCZZ.Table.al — calls the vendor check on "Pay-to Vendor No." validation (Transaction=false) and in CheckPurchaseAdvanceLetterPostRestrictions (Transaction=true).
Test changes (2 files, 14 new tests):
Purchase Advance Payments (codeunit 148108) — 6 tests:
CreatePurchAdvLetterWithVendorBlockedAll — error on validation with Blocked::All
CreatePurchAdvLetterWithVendorBlockedPayment — error on validation with Blocked::Payment
CreatePurchAdvLetterWithPrivacyBlockedVendor — error on validation with Privacy Blocked
PostPaymentPurchAdvLetterWithVendorBlockedAll — error on posting with Blocked::All
PostPaymentPurchAdvLetterWithVendorBlockedPayment — error on posting with Blocked::Payment
PostPaymentPurchAdvLetterWithPrivacyBlockedVendor — error on posting with Privacy Blocked
Sales Advance Payments (codeunit 148109) — 8 tests:
CreateSalesAdvLetterWithCustomerBlockedAll — error on validation with Blocked::All
CreateSalesAdvLetterWithCustomerBlockedShip — error on validation with Blocked::Ship
CreateSalesAdvLetterWithCustomerBlockedInvoice — error on validation with Blocked::Invoice
CreateSalesAdvLetterWithPrivacyBlockedCustomer — error on validation with Privacy Blocked
PostPaymentSalesAdvLetterWithCustomerBlockedAll — error on posting with Blocked::All
PostPaymentSalesAdvLetterWithCustomerBlockedShip — error on posting with Blocked::Ship
PostPaymentSalesAdvLetterWithCustomerBlockedInvoice — error on posting with Blocked::Invoice
PostPaymentSalesAdvLetterWithPrivacyBlockedCustomer — error on posting with Privacy Blocked
All tests verify the exact error message text. Helper functions CreateBlockedVendor/CreateBlockedCustomer and shared base procedures reduce duplication.
Risk & compatibility
This is a stricter validation — advance letters previously allowed blocked vendors/customers. Existing advance letters with blocked parties will fail on subsequent payment posting, which is the intended behavior matching standard document blocking.