-
Code change in Gen. Jnl. Post Batch BC23.2
The procedure changed and now the customers have to post it one by one as they do not need to enable Force Document Balance and post.
BC22.0 codeunit 13 - procedure ProcessBalanceOfLines:
This code will NOT sort the Journal on "Bal. Account No." and will post fine.
begin
IsProcessingKeySet := false;
OnBeforeProcessBalanceOfLines(GenJnlLine, GenJnlBatch, GenJnlTemplate, IsProcessingKeySet);
if not IsProcessingKeySet then
if GenJnlTemplate."Force Doc. Balance" then
GenJnlLine.SetCurrentKey("Document No.", "Posting Date");
LineCount := 0;
LastDate := 0D;
LastDocType := LastDocType::" ";
LastDocNo := '';
BC23.2 codeunit 13 - procedure ProcessBalanceOfLines:
This code has added an ELSE with a new SetCurrentKey, it will sort the journal differently, thus generating a failure on checking whether the next Document No. is correct. Definitely not an optimal design.
begin
IsProcessingKeySet := false;
OnBeforeProcessBalanceOfLines(GenJnlLine, GenJnlBatch, GenJnlTemplate, IsProcessingKeySet);
if not IsProcessingKeySet then
if GenJnlTemplate."Force Doc. Balance" then
GenJnlLine.SetCurrentKey("Document No.", "Posting Date")
else
GenJnlLine.SetCurrentKey("Journal Template Name", "Journal Batch Name", "Bal. Account No.");
LineCount := 0;
LastDate := 0D;
LastDocType := LastDocType::" ";
LastDocNo := '';
LastFAAddCurrExchRate := 0;
Further down Codeunit 13 is: if ShouldCheckDocNoBasedOnNoSeries then
CheckDocNoBasedOnNoSeries(LastDocNo, GenJnlBatch."No. Series", NoSeriesMgt);
Here it fails because the Journal is incorrectly sorted