ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 81 - Gen. Journal Line - OnBeforeCheckCurrencyForEmployee

Open xtiche opened this issue 4 years ago • 1 comments

Please add events to make it possible to create Employee Ledger Entry in Currency, there are several places where we cannot handle errors:

field(12; "Currency Code"; Code[10])
{
    Caption = 'Currency Code';
    TableRelation = Currency;

    trigger OnValidate()
    var
        BankAcc: Record "Bank Account";
    begin
        if "Bal. Account Type" = "Bal. Account Type"::"Bank Account" then begin
            if BankAcc.Get("Bal. Account No.") and (BankAcc."Currency Code" <> '') then
                BankAcc.TestField("Currency Code", "Currency Code");
        end;
        if "Account Type" = "Account Type"::"Bank Account" then begin
            if BankAcc.Get("Account No.") and (BankAcc."Currency Code" <> '') then
                BankAcc.TestField("Currency Code", "Currency Code");
        end;
        if ("Recurring Method" in
            ["Recurring Method"::"B  Balance", "Recurring Method"::"RB Reversing Balance"]) and
            ("Currency Code" <> '')
        then
            Error(
                Text001,
                FieldCaption("Currency Code"), FieldCaption("Recurring Method"), "Recurring Method");

        if "Currency Code" <> '' then begin
            // new event ++ 
            OnValidateCurrencyCodeOnBeforeCheckCurrencyForEmployee(Rec, IsHandled);
            if not IsHandled then
            // new event --
                if ("Bal. Account Type" = "Bal. Account Type"::Employee) or ("Account Type" = "Account Type"::Employee) then
                    Error(OnlyLocalCurrencyForEmployeeErr);
           ...
           
    end;
}
       field(63; "Bal. Account Type"; Enum "Gen. Journal Account Type")
{
    Caption = 'Bal. Account Type';

    trigger OnValidate()
    begin
        if ("Account Type" in ["Account Type"::Customer, "Account Type"::Vendor, "Account Type"::"Fixed Asset",
                                "Account Type"::"IC Partner", "Account Type"::Employee]) and
            ("Bal. Account Type" in ["Bal. Account Type"::Customer, "Bal. Account Type"::Vendor, "Bal. Account Type"::"Fixed Asset",
                                    "Bal. Account Type"::"IC Partner", "Bal. Account Type"::Employee])
        then
            Error(
                Text000,
                FieldCaption("Account Type"), FieldCaption("Bal. Account Type"));

        // new event ++ 
        OnValidateBalAccountTypeOnBeforeCheckCurrencyForEmployee(Rec, IsHandled);
        if not IsHandled then
            // new event --
            if ("Bal. Account Type" = "Bal. Account Type"::Employee) and ("Currency Code" <> '') then
                Error(OnlyLocalCurrencyForEmployeeErr);

        ReadGLSetup();
        if GLSetup."Journal Templ. Name Mandatory" then
            if GenJnlTemplate.Name <> "Journal Template Name" then
                GenJnlTemplate.Get("Journal Template Name");

        OnValidateBalAccountTypeOnBeforeSetBalAccountNo(Rec, xRec);               
        ...
    end;
}

xtiche avatar Nov 10 '22 12:11 xtiche

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

JesperSchulz avatar Jan 12 '23 13:01 JesperSchulz