ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 5631 - FA Jnl.-Check Line - OnCheckConsistencyOnBeforeCheckQuantityFAJnlPosting

Open Codey42 opened this issue 4 years ago • 1 comments

Dear ALAppExtensions team,

Through this issue we would like to request adding event publisher OnCheckConsistencyOnBeforeCheckQuantityFAJnlPosting in Codeunit 5631 FA Jnl.-Check Line with the following signature:

[IntegrationEvent(false, false)]
local procedure OnCheckConsistencyOnBeforeCheckQuantityFAJnlPosting(var FAJournalLine: Record "FA Journal Line";
                                                                    var IsHandled: Boolean)
begin
end;

with VAR parameter FAJournalLine. which would be called as follows in CheckConsistency:

local procedure CheckConsistency()
var
    IsHandled: Boolean;
begin
    if GenJnlPosting then
        ...

    if not GenJnlPosting then
        with FAJnlLine do begin
            FieldErrorText :=
              StrSubstNo(Text011,
                FieldCaption("FA Posting Type"), "FA Posting Type");

            if ("FA Error Entry No." > 0) and ("FA Posting Type" = "FA Posting Type"::Maintenance) then
                FieldError("FA Error Entry No.", FieldErrorText);

            if "FA Posting Type" <> "FA Posting Type"::"Acquisition Cost" then
                case true of
                    "Depr. Acquisition Cost":
                        FieldError("Depr. Acquisition Cost", FieldErrorText);
                    "Salvage Value" <> 0:
                        FieldError("Salvage Value", FieldErrorText);
                    Quantity <> 0:
                        begin
                            IsHandled := false;
                            // >>>> Current >>>>>>>>>>>>>>>>>>>>
                            // -> This seems to be wrong due to "GenJnlLine" is not used within this code block.
                            // -> See line "if not GenJnlPosting then" a few lines before.
                            //OnCheckConsistencyOnBeforeCheckQuantity(GenJnlLine, IsHandled);
                            // <<<< Current <<<<<<<<<<<<<<<<<<<<
                            // >>>>>> New >>>>>>>>>>>>>>>>>>>>>>
                            OnCheckConsistencyOnBeforeCheckQuantityFAJnlPosting(FAJnlLine, IsHandled);
                            // <<<<<< New <<<<<<<<<<<<<<<<<<<<<<
                            if not IsHandled then
                                if "FA Posting Type" <> "FA Posting Type"::Maintenance then
                                    FieldError(Quantity, FieldErrorText);
                        end;
                    "Insurance No." <> '':
                        FieldError("Insurance No.", FieldErrorText);
                end;

Codey42 avatar Mar 15 '22 15:03 Codey42

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.

JesperSchulz avatar Apr 19 '22 15:04 JesperSchulz