Skip to content

[Event Request] Codeunit 426 "Payment Tolerance Management" OnPmtTolGenJnlOnAfterCheckConditions #30277

@RytisLemezis

Description

@RytisLemezis

Why do you need this change?

In 4PS Construct, we need to perform additional adjustments to the general journal line during payment tolerance handling before the standard customer or vendor payment tolerance logic continues.

The integration event OnPmtTolGenJnlOnAfterCheckConditions is raised in procedure PmtTolGenJnl after the initial guard conditions have been checked, and we need to change GenJournalLine just before the code continues into SalesPmtTolGenJnl or PurchPmtTolGenJnl.

To support this scenario, we need the GenJournalLine parameter of OnPmtTolGenJnlOnAfterCheckConditions to be passed by reference.

Describe the request

Dear ALAppExtensions team,

On behalf of 4PS, I would like to request an update to the integration event OnPmtTolGenJnlOnAfterCheckConditions in the procedure PmtTolGenJnl in codeunit "Payment Tolerance Management".

procedure PmtTolGenJnl(var NewGenJnlLine: Record "Gen. Journal Line") Result: Boolean
var
    TempGenJnlLine: Record "Gen. Journal Line" temporary;
begin
    TempGenJnlLine := NewGenJnlLine;

    if TempGenJnlLine."Check Printed" then
        exit(true);

    if TempGenJnlLine."Financial Void" then
        exit(true);

    if (TempGenJnlLine."Applies-to Doc. No." = '') and (TempGenJnlLine."Applies-to ID" = '') then
        exit(true);

    OnPmtTolGenJnlOnAfterCheckConditions(TempGenJnlLine, SuppressCommit, Result);

    case true of
        (TempGenJnlLine."Account Type" = TempGenJnlLine."Account Type"::Customer) or
      (TempGenJnlLine."Bal. Account Type" = TempGenJnlLine."Bal. Account Type"::Customer):
            exit(SalesPmtTolGenJnl(TempGenJnlLine));
        (TempGenJnlLine."Account Type" = TempGenJnlLine."Account Type"::Vendor) or
      (TempGenJnlLine."Bal. Account Type" = TempGenJnlLine."Bal. Account Type"::Vendor):
            exit(PurchPmtTolGenJnl(TempGenJnlLine));
    end;

    OnAfterPmtTolGenJnl(TempGenJnlLine, SuppressCommit, Result);
end;

Current integration event:

[IntegrationEvent(false, false)]
local procedure OnPmtTolGenJnlOnAfterCheckConditions(GenJournalLine: Record "Gen. Journal Line"; var SuppressCommit: Boolean; var Result: Boolean)
begin
end;

Suggested version:

[IntegrationEvent(false, false)]
local procedure OnPmtTolGenJnlOnAfterCheckConditions(var GenJournalLine: Record "Gen. Journal Line"; var SuppressCommit: Boolean; var Result: Boolean)
begin
end;

Internal work item: AB#639592

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions