microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
749 stars 600 forks source link

[Event Request] Codeunit 99000813 "Carry Out Action" add new parameters to OnPurchOrderChgAndResheduleOnAfterGetPurchHeader event #26740

Closed MSdracanovic closed 1 week ago

MSdracanovic commented 2 weeks ago

Describe the request

Could you please add new parameters, RequisitionLine and PurchaseLine to the existing event OnPurchOrderChgAndResheduleOnAfterGetPurchHeaderin codeunit 99000813 "Carry Out Action"?

    procedure PurchOrderChgAndReshedule(RequisitionLine: Record "Requisition Line")
    var
        PurchaseLine: Record "Purchase Line";
        PurchaseHeader: Record "Purchase Header";
    begin
        RequisitionLine.TestField("Ref. Order Type", RequisitionLine."Ref. Order Type"::Purchase);
        if PurchaseLine.Get(PurchaseLine."Document Type"::Order, RequisitionLine."Ref. Order No.", RequisitionLine."Ref. Line No.") then begin
            OnPurchOrderChgAndResheduleOnAfterGetPurchLine(PurchaseLine);
            PurchaseLine.BlockDynamicTracking(true);
            PurchaseLine.Validate(Quantity, RequisitionLine.Quantity);
            OnPurchOrderChgAndResheduleOnBeforeValidateExpectedReceiptDate(RequisitionLine);
            PurchaseLine.Validate("Expected Receipt Date", RequisitionLine."Due Date");
            PurchaseLine.Validate("Planning Flexibility", RequisitionLine."Planning Flexibility");
            OnPurchOrderChgAndResheduleOnBeforePurchLineModify(RequisitionLine, PurchaseLine);
            PurchaseLine.Modify(true);
            ReqLineReserve.TransferReqLineToPurchLine(RequisitionLine, PurchaseLine, 0, true);
            ReqLineReserve.UpdateDerivedTracking(RequisitionLine);
            ReservationManagement.SetReservSource(PurchaseLine);
            ReservationManagement.DeleteReservEntries(false, PurchaseLine."Outstanding Qty. (Base)");
            ReservationManagement.ClearSurplus();
            ReservationManagement.AutoTrack(PurchaseLine."Outstanding Qty. (Base)");

            PurchaseHeader.Get(PurchaseLine."Document Type", PurchaseLine."Document No.");
            // new code
            //OnPurchOrderChgAndResheduleOnAfterGetPurchHeader(PurchaseHeader);
            OnPurchOrderChgAndResheduleOnAfterGetPurchHeader(PurchaseHeader,RequisitionLine ,PurchaseLine);
           // new code
            PrintPurchaseOrder(PurchaseHeader);
        end else
            Error(CouldNotChangeSupplyTxt, RequisitionLine."Ref. Order No.", RequisitionLine."Ref. Line No.");
    end;
    [IntegrationEvent(false, false)]
    local procedure OnPurchOrderChgAndResheduleOnAfterGetPurchHeader(var PurchaseHeader: Record "Purchase Header"; RequisitionLine: Record "Requisition Line"; PurchaseLine: Record "Purchase Line")
    begin
    end;

Additional context

One of our functionalities requires that the "Purchase Header" table be modified depending on the value in the "Requisition Line" table. New parameters in the publisher function OnPurchOrderChgAndResheduleOnAfterGetPurchHeader would allow us to easily modify the "Purchase Header" table Internal work item: AB#539586

JesperSchulz commented 1 week ago

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