codeunit 78650 "Sales-Post Commit Behaviour"
{
SingleInstance = true;
var
SetErrorOnCommit: Boolean;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnRunOnBeforeCheckAndUpdate', '', false, false)]
local procedure OnRunOnBeforeCheckAndUpdate(var SalesHeader: Record "Sales Header")
begin
if SalesHeader."Send IC Document" and (SalesHeader."IC Status" = SalesHeader."IC Status"::New) and (SalesHeader."IC Direction" = SalesHeader."IC Direction"::Outgoing)
and (SalesHeader."Document Type" in [SalesHeader."Document Type"::Order, SalesHeader."Document Type"::"Return Order"]) then
SetErrorOnCommit := true
else
SetErrorOnCommit := false;
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnSetCommitBehavior', '', false, false)]
local procedure OnSetCommitBehavior(var ErrorOnCommit: Boolean)
begin
if SetErrorOnCommit then
ErrorOnCommit := false;
end;
}