microsoft / microsoft/BCApps

[Bug]: Missing Blocked Check for the Bill-to Customer in Job

Open
#9,559 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved Ownership: Manual Team: SCM
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

In the job table the Sell-to Customer No. is checked when it's validated wether the customer is blocked, but the bill-to customer no. isn't checked for the Blocked value of the customer.

This is issue is a follow up to issue: https://github.com/microsoft/BusinessCentralApps/issues/1837

Expected behavior

I would suggest to bring back a Blocked check in the Bill-To customer no. field and align with the check on sales orders.

Steps to reproduce
  • Create a job
  • Create a not blocked customer for Sell-to
  • Create a blocked customer for Bill-to
  • Validate the Sell-to
  • // [WHEN] The Bill-to is validated
  • // [THEN] We would expect an error when a blocked customer is validated as bill-to
Additional context

I guess that this issue was created when the Job table was improved by having a sell-to cutomer no addtional to the bill-to customer no.

When you check the source for BC19 then you will see that there was a check for the bill-to customer no.
https://github.com/StefanMaron/MSDyn365BC.Code.History/blob/w1-19/BaseApp/Source/Base%20Application/Job.Table.al

            if Cust.Blocked = Cust.Blocked::All then
                Error(
                  BlockedCustErr,
                  FieldCaption("Bill-to Customer No."),
                  "Bill-to Customer No.",
                  Cust.TableCaption,
                  FieldCaption(Blocked),
                  Cust.Blocked);

This is the code in the Job Table in current BC:

        if Job."Sell-to Customer No." <> '' then begin
            SellToCustomer.Get(Job."Sell-to Customer No.");
            IsHandled := false;
            OnValidateSellToCustomerNoOnBeforeCheckBlockedCustOnDocs(Rec, SellToCustomer, IsHandled);
            if not IsHandled then
                SellToCustomer.CheckBlockedCustOnDocs(SellToCustomer, Enum::"Sales Document Type"::Order, false, false);
        end;
I will provide a fix for a bug
  • I will provide a fix for a bug

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

Start in the current Job table at the Sell-to Customer No. validation entry point and compare it with the historical BaseApp/Source/Base Application/Job.Table.al snippet. Trace the Bill-to Customer No. validation and existing blocked-customer checks; done means a blocked bill-to customer produces the expected error, with coverage in the relevant Job table tests if present.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.