microsoft / microsoft/BCApps

[W1] [Codeunit] [37203] [PEPPOL30 Sales Validation Impl] Add event before Customer GLN/VAT Registration No. validation

Open Beginner friendly
#11,602 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

missing-info Team: Finance
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Why do you need this change?

We need to create ZUGFeRD e-documents for customers without the need for a VAT Registration No. or GLN.

In the previous PEPPOL validation implementation (Codeunit 1620 "PEPPOL Validation"), integration events were available to influence this validation. These extensibility points are no longer available in the new Codeunit 37203 "PEPPOL30 Sales Validation Impl".

Therefore, we currently have no way to handle or skip the customer GLN/VAT Registration No. validation from an extension.

Describe the request

Please add an integration event before the customer GLN/VAT Registration No. validation in procedure CheckSalesDocument of Codeunit 37203 "PEPPOL30 Sales Validation Impl".

A similar extensibility point existed in the previous PEPPOL validation implementation.

The event should allow an extension to handle this specific validation and skip the standard error when required.

Current Code:

if (SalesHeader."Document Type" in [SalesHeader."Document Type"::Invoice, SalesHeader."Document Type"::Order, SalesHeader."Document Type"::"Credit Memo"]) and
   Customer.Get(SalesHeader."Bill-to Customer No.")
then
    if (Customer.GLN + Customer."VAT Registration No.") = '' then
       Error(MissingCustGLNOrVATRegNoErr, Customer."No.");

Suggested Change:

IsHandled := false;
OnCheckSalesDocumentOnBeforeCheckCustomerVATRegNo(SalesHeader, Customer, IsHandled);
if not IsHandled then
   if (SalesHeader."Document Type" in [SalesHeader."Document Type"::Invoice, SalesHeader."Document Type"::Order, SalesHeader."Document Type"::"Credit Memo"]) and
   Customer.Get(SalesHeader."Bill-to Customer No.")
      if Customer.GLN + Customer."VAT Registration No." = '' then
         Error(MissingCustGLNOrVATRegNoErr, Customer."No.");

[IntegrationEvent(false, false)]
local procedure OnCheckSalesDocumentOnBeforeCheckCustomerVATRegNo(SalesHeader: Record "Sales Header"; Customer: Record Customer; var IsHandled: Boolean)
begin
end;
Provide an implementation (optional)
  • I will provide the implementation for this extensibility request

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Codeunit 37203 "PEPPOL30 Sales Validation Impl" and locate the CheckSalesDocument procedure and its customer GLN/VAT Registration No. validation. Compare the requested extensibility point with the previous Codeunit 1620 implementation; done means an extension can handle this validation and suppress the standard error when required.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.