microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 12 "Gen. Jnl.-Post Line" - OnPostDtldCustLedgEntriesOnAfterPostDtldCustLedgEntry #27042

Open RZ440 opened 1 month ago

RZ440 commented 1 month ago

Describe the request

In the Event Request #26847 we asked for a new event OnPostDtldCustLedgEntriesOnAfterPostDtldCustLedgEntry in Codeunit 12 "Gen. Jnl.-Post Line".

    procedure PostDtldCustLedgEntries(GenJnlLine: Record "Gen. Journal Line"; var DtldCVLedgEntryBuf: Record "Detailed CV Ledg. Entry Buffer"; CustPostingGr: Record "Customer Posting Group"; LedgEntryInserted: Boolean) DtldLedgEntryInserted: Boolean
.
.
.
        if DtldCVLedgEntryBuf.FindSet() then begin
            IsHandled := false;
            OnPostDtldCustLedgEntriesOnBeforeNextEntryNo(GenJnlLine, DtldCVLedgEntryBuf, CustPostingGr, LedgEntryInserted, NextEntryNo, SaveEntryNo, IsHandled);
            if not IsHandled then
                if LedgEntryInserted then begin
                    SaveEntryNo := NextEntryNo;
                    IncrNextEntryNo();
                end;
            repeat
                InsertDtldCustLedgEntry(GenJnlLine, DtldCVLedgEntryBuf, DtldCustLedgEntry, DtldCustLedgEntryNoOffset);
                IsHandled := false;
                OnPostDtldCustLedgEntriesOnBeforeUpdateTotalAmounts(GenJnlLine, DtldCustLedgEntry, IsHandled, DtldCVLedgEntryBuf);
                if not IsHandled then
                    UpdateTotalAmounts(TempDimPostingBuffer, GenJnlLine."Dimension Set ID", DtldCVLedgEntryBuf);
                IsHandled := false;
                OnPostDtldCustLedgEntriesOnBeforePostDtldCustLedgEntry(DtldCVLedgEntryBuf, AddCurrencyCode, GenJnlLine, CustPostingGr, AdjAmount, IsHandled, NextEntryNo);
                if not IsHandled then
                    if ((DtldCVLedgEntryBuf."Amount (LCY)" <> 0) or
                        (DtldCVLedgEntryBuf."VAT Amount (LCY)" <> 0)) or
                       ((AddCurrencyCode <> '') and (DtldCVLedgEntryBuf."Additional-Currency Amount" <> 0))
                    then begin
                        PostDtldCustLedgEntry(GenJnlLine, DtldCVLedgEntryBuf, CustPostingGr, AdjAmount);
                        OnPostDtldCustLedgEntriesOnAfterPostDtldCustLedgEntry(DtldCVLedgEntryBuf, DtldCustLedgEntry, LedgEntryInserted);
                    end;
            until DtldCVLedgEntryBuf.Next() = 0;
        end;
    [IntegrationEvent(false, false)]
    local procedure OnPostDtldCustLedgEntriesOnAfterPostDtldCustLedgEntry(var DetailedCVLedgEntryBuffer: Record "Detailed CV Ledg. Entry Buffer"; DetailedCustLedgEntry: Record "Detailed Cust. Ledg. Entry"; LedgEntryInserted: Boolean)
    begin
    end;

Additional context

You rejected the request recommending to use InsertDtldCustLedgEntry. But there ??? as well as in the events provided ??? we do not know the parameter value LedgEntryInserted. And we are a little confused that you rejected this event while you accepted the event request #26862 which is equivalent for DtldVendLedgEntry. We would prefer implementing the subscribers for Cust and Vend correspondingly. Could you please check our request again? Internal work item: AB#544531