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 80 "Sales-Post".PostJobContractLine #27937

Open
fridrichovsky opened this issue Jan 13, 2025 · 0 comments
Open

[Event Request] Codeunit 80 "Sales-Post".PostJobContractLine #27937

fridrichovsky opened this issue Jan 13, 2025 · 0 comments
Labels
event-request Request for adding an event SCM GitHub request for SCM area

Comments

@fridrichovsky
Copy link
Contributor

fridrichovsky commented Jan 13, 2025

Describe the request

Please add new event

local procedure PostJobContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line")
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforePostJobContractLine(
            SalesHeader, SalesLine, IsHandled, JobContractLine, InvoicePostingInterface, SalesLineACY, SalesInvHeader, SalesCrMemoHeader);
        if IsHandled then
            exit;

        if SalesLine."Job Contract Entry No." = 0 then
            exit;

        IsHandled := false;
        OnPostJobContractLineBeforeTestFields(SalesHeader, SalesLine, IsHandled);
        if not IsHandled then begin
            if (SalesHeader."Document Type" <> SalesHeader."Document Type"::Invoice) and
               (SalesHeader."Document Type" <> SalesHeader."Document Type"::"Credit Memo")
            then
                SalesLine.TestField("Job Contract Entry No.", 0);

            SalesLine.TestField("Job No.");
            SalesLine.TestField("Job Task No.");
        end;

        if SalesHeader."Document Type" = SalesHeader."Document Type"::Invoice then
            SalesLine."Document No." := SalesInvHeader."No.";
        if SalesHeader."Document Type" = SalesHeader."Document Type"::"Credit Memo" then
            SalesLine."Document No." := SalesCrMemoHeader."No.";
        JobContractLine := true;
#if not CLEAN23
        if UseLegacyInvoicePosting() then
            JobPostLine.PostInvoiceContractLine(SalesHeader, SalesLine)
        else
#endif
        InvoicePostingInterface.PrepareJobLine(SalesHeader, SalesLine, SalesLineACY);
        //----------------------------------------------------OnAfterPostJobContractLine:BEGIN
        OnAfterPostJobContractLine(SalesHeader, SalesLine, GenJnlLineDocType, GenJnlLineDocNo, GenJnlLineExtDocNo, SrcCode);
        //----------------------------------------------------OnAfterPostJobContractLine:END
    end;

    //----------------------------------------------------OnAfterPostJobContractLine:BEGIN
    [IntegrationEvent(true, false)]
    local procedure OnAfterPostJobContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; var GenJnlLineDocType: Enum "Gen. Journal Document Type"; var GenJnlLineDocNo: Code[20]; var GenJnlLineExtDocNo: Code[35]; var SrcCode: Code[10])
    begin
    end;
    //----------------------------------------------------OnAfterPostJobContractLine:END


Additional context

We need do action at the end of function.
Internal work item: AB#562603

@JesperSchulz JesperSchulz added event-request Request for adding an event SCM GitHub request for SCM area labels Jan 16, 2025
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 SCM GitHub request for SCM area
Projects
None yet
Development

No branches or pull requests

2 participants