Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] Codeunit 370 "Bank Acc. Reconciliation Post".FinalizePost #27940

Closed
fridrichovsky opened this issue Jan 13, 2025 · 1 comment
Closed
Labels
event-request Request for adding an event Finance GitHub request for Finance area ships-in-future-update Fix ships in a future update

Comments

@fridrichovsky
Copy link
Contributor

fridrichovsky commented Jan 13, 2025

Describe the request

Please add new event

local procedure FinalizePost(BankAccRecon: Record "Bank Acc. Reconciliation")
   var
       BankAccReconLine: Record "Bank Acc. Reconciliation Line";
       AppliedPmtEntry: Record "Applied Payment Entry";
       CreationDateTime: DateTime;
       MatchedWithAI: Boolean;
       LineCount: Integer;
       TelemetryCategories: Dictionary of [Text, Text];
       DurationUntilPosting: BigInteger;
       //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
       IsHandled: Boolean;
   //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END
   begin
       if PreviewMode then
           exit;
       OnBeforeFinalizePost(BankAccRecon);
       CreationDateTime := BankAccRecon.SystemCreatedAt;
       MatchedWithAI := AIMatchProposalsExist(BankAccRecon);
       //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
       IsHandled := false;
       OnFinalizePostOnBeforeLineExist(BankAccRecon, BankAccReconLine, AppliedPmtEntry, LineCount, IsHandled);
       if not IsHandled then
           //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END
           if BankAccReconLine.LinesExist(BankAccRecon) then
               repeat
                   AppliedPmtEntry.FilterAppliedPmtEntry(BankAccReconLine);
                   AppliedPmtEntry.DeleteAll();

                   BankAccReconLine.Delete();
                   BankAccReconLine.ClearDataExchEntries();
                   LineCount += 1;

               until BankAccReconLine.Next() = 0;

       BankAccRecon.Find();
       //----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:BEGIN
       IsHandled := false;
       OnFinalizePostOnBeforeDeleteBankAccReconciliation(BankAccRecon, IsHandled);
       if not IsHandled then
           //----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:END
           BankAccRecon.Delete();
       TelemetryCategories.Add('Category', BankAccountRecCategoryLbl);
       TelemetryCategories.Add('MatchedWithAI', Format(MatchedWithAI, 0, 9));
       TelemetryCategories.Add('NumberOfLines', Format(LineCount));
       if TryCalculateDurationToPost(DurationUntilPosting, CreationDateTime) then
           Session.LogMessage('0000LHY', Format(DurationUntilPosting), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, TelemetryCategories);
       OnAfterFinalizePost(BankAccRecon);
   end;

   //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
   [IntegrationEvent(true, false)]
   local procedure OnFinalizePostOnBeforeLineExist(BankAccRecon: Record "Bank Acc. Reconciliation"; var BankAccReconLine: Record "Bank Acc. Reconciliation Line"; var AppliedPmtEntry: Record "Applied Payment Entry"; var LineCount: Integer; var IsHandled: Boolean)
   begin
   end;
   //--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END


   //----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:BEGIN
   [IntegrationEvent(true, false)]
   local procedure OnFinalizePostOnBeforeDeleteBankAccReconciliation(BankAccRecon: Record "Bank Acc. Reconciliation"; var IsHandled: Boolean)
   begin
   end;
   //----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:END


Additional context

We need option to keep BankAccRecon after post.
Internal work item: AB#562597

@JesperSchulz JesperSchulz added event-request Request for adding an event Finance GitHub request for Finance area labels Jan 16, 2025
@JesperSchulz JesperSchulz added the ships-in-future-update Fix ships in a future update label Jan 28, 2025
@JesperSchulz
Copy link
Contributor

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: 29093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Finance GitHub request for Finance area ships-in-future-update Fix ships in a future update
Projects
None yet
Development

No branches or pull requests

2 participants