ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 5912 "ServLedgEntries-Post" - multiple publishers

Open alapenas opened this issue 3 years ago • 3 comments

Hello, would it be possible to add OnBeforeInsertServLedgerEntry, OnBeforeInsertServLedgerEntrySale, OnBeforeInsertServLedgEntryCrMemo events to codeunit 5912 "ServLedgEntries-Post", like this:

    local procedure InsertServLedgerEntryCrMUsage(var NextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; DocNo: Code[20]) 
... 
          LineAmount: Decimal;
         Result: Integer;
         IsHandled: Boolean;
     begin
>         OnBeforeInsertServLedgerEntry(NextEntryNo, ServHeader, TempServLine, ServItemLine, Qty, DocNo, Result, IsHandled);//New Event
         if IsHandled then
             exit(Result);
 
         ServLedgEntry.LockTable(); 
    procedure InsertServLedgerEntrySale(var PassedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; Qty: Decimal; QtyToCharge: Decimal; GenJnlLineDocNo: Code[20]; DocLineNo: Integer) 
... 
          CurrExchRate: Record "Currency Exchange Rate";
         TotalAmount: Decimal;
         IsHandled: Boolean;
     begin
>         OnBeforeInsertServLedgerEntrySale(PassedNextEntryNo, ServHeader, ServLine, ServItemLine, ServLedgEntry, Qty, QtyToCharge, GenJnlLineDocNo, DocLineNo, IsHandled);//New Event
         if IsHandled then
             exit;
 
         if (ServLine."Document No." = '') and 
    local procedure InsertServLedgEntryCrMemo(var PassedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; GenJnlLineDocNo: Code[20]) 
... 
          ServItem: Record "Service Item";
         TotalAmount: Decimal;
         IsHandled: Boolean;
     begin
>         OnBeforeInsertServLedgEntryCrMemo(PassedNextEntryNo, ServHeader, ServLine, GenJnlLineDocNo, IsHandled);//New Event
         if IsHandled then
             exit;
         if ServLine."Qty. to Invoice" = 0 then
             exit; 
  
     [IntegrationEvent(false, false)]
     local procedure OnBeforeInsertServLedgerEntry(var NextEntryNo: Integer; var ServHeader: Record "Service Header"; var TempServLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; Qty: Decimal; DocNo: Code[20]; var Result: Integer; var IsHandled: Boolean)
     begin
     end; 
  
     [IntegrationEvent(false, false)]
     local procedure OnBeforeInsertServLedgerEntrySale(var PassedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; var ServLedgEntry: Record "Service Ledger Entry"; Qty: Decimal; QtyToCharge: Decimal; GenJnlLineDocNo: Code[20]; DocLineNo: Integer; var IsHandled: Boolean)
     begin
     end; 
  
     [IntegrationEvent(false, false)]
     local procedure OnBeforeInsertServLedgEntryCrMemo(var PassedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; GenJnlLineDocNo: Code[20]; var IsHandled: Boolean)
     begin
     end; 

alapenas avatar Feb 27 '23 16:02 alapenas

Please explain why do you want to ignore insert of service ledger entries? It will break basic functionality in Service Management module.

AlexanderYakunin avatar Apr 05 '23 08:04 AlexanderYakunin

Hello, since Service Ledger entries are posted directly without journals, a custom journal was created to match standard journals like Item Journal, G/L journal, FA Journal. For this purpose, 3 new publishers are required in each procedure's beginning.

alapenas avatar Apr 24 '23 11:04 alapenas

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 11137.

JesperSchulz avatar Jun 15 '23 15:06 JesperSchulz