Skip to content

[Bug]: Missing PreviewMode parameter on Purchase Post events #8910

Description

@y0m0

Describe the issue

Describe the issue

Some of the Purchase posting codeunit events do not have PreviewMode parameter in it.

This makes it harder for partner to prevent their code running if the posting is in PreviewMode.

We should add PreviewMode to any events that has SuppressCommit on below codeunit:

codeunit 90 "Purch.-Post"

Expected behavior

Here's an example on codeunit 90 "Purch.-Post"

internal procedure RunWithCheck(var TransferHeader2: Record "Transfer Header")
begin
...
OnAfterProcessPurchLines(PurchHeader, PurchRcptHeader, PurchInvHeader, PurchCrMemoHeader, ReturnShptHeader, WhseShip, WhseReceive, PurchaseLinesProcessed, SuppressCommit, EverythingInvoiced, PreviewMode);
...
...
OnAfterPostPurchaseDoc(PurchaseHeader2, GenJnlPostLine, PurchRcptHeader."No.", ReturnShptHeader."No.", PurchInvHeader."No.", PurchCrMemoHeader."No.", SuppressCommit, PreviewMode);
...
end;
[IntegrationEvent(false, false)]
local procedure OnAfterProcessPurchLines(var PurchHeader: Record "Purchase Header"; var PurchRcptHeader: Record "Purch. Rcpt. Header"; var PurchInvHeader: Record "Purch. Inv. Header"; var PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; var ReturnShipmentHeader: Record "Return Shipment Header"; WhseShip: Boolean; WhseReceive: Boolean; var PurchLinesProcessed: Boolean; CommitIsSuppressed: Boolean; EverythingInvoiced: Boolean; PreviewMode: Boolean)
begin
end;


[IntegrationEvent(false, false)]
procedure OnAfterPostPurchaseDoc(var PurchaseHeader: Record "Purchase Header"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; PurchRcpHdrNo: Code[20]; RetShptHdrNo: Code[20]; PurchInvHdrNo: Code[20]; PurchCrMemoHdrNo: Code[20]; CommitIsSupressed: Boolean; PreviewMode: Boolean)
begin
end;

Steps to reproduce

n/a

Additional context

ALAppExtensions/issues/27663

BusinessCentralApps/issues/1430

ADO GitHub Issue: #581951

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM area

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions