microsoft / ALAppExtensions

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

[Event Request] Codeunit 333 "Req. Wksh.-Make Order". CheckInsertFinalizePurchaseOrderHeader #27646

Open fridrichovsky opened 1 week ago

fridrichovsky commented 1 week ago

Describe the request

Please add new event

local procedure CheckInsertFinalizePurchaseOrderHeader(RequisitionLine: Record "Requisition Line"; var PurchOrderHeader: Record "Purchase Header"; UpdateAddressDetails: Boolean): Boolean
    var
        CheckInsert: Boolean;
        CheckAddressDetailsResult: Boolean;
        //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:BEGIN
        IsHandled: Boolean;
       //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:END
    begin
        //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:BEGIN
        IsHandled := false;
        OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails(Rec, CheckAddressDetailsResult, IsHandled);
        if not IsHandled then
        //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:END
            CheckAddressDetailsResult := CheckAddressDetails(RequisitionLine."Sales Order No.", RequisitionLine."Sales Order Line No.", UpdateAddressDetails);
        CheckInsert :=
              (PurchOrderHeader."Buy-from Vendor No." <> RequisitionLine."Vendor No.") or
              (PurchOrderHeader."Sell-to Customer No." <> RequisitionLine."Sell-to Customer No.") or
              (PrevShipToCode <> RequisitionLine."Ship-to Code") or
              (PurchOrderHeader."Order Address Code" <> RequisitionLine."Order Address Code") or
              (PurchOrderHeader."Currency Code" <> RequisitionLine."Currency Code") or
              (PrevPurchCode <> RequisitionLine."Purchasing Code") or
              CheckAddressDetailsResult;

        OnBeforeCheckInsertFinalizePurchaseOrderHeader(
            RequisitionLine, PurchOrderHeader, CheckInsert, OrderCounter, PrevPurchCode, PrevLocationCode, PrevShipToCode, UpdateAddressDetails, CheckAddressDetailsResult, ReceiveDateReq);
        exit(CheckInsert);
    end;

    //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:BEGIN
    [IntegrationEvent(true, false)]
    local procedure OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails(RequisitionLine: Record "Requisition Line"; CheckAddressDetailsResult: Boolean; var IsHandled: Boolean)
    begin
    end;
    //------------------------------------------------------------------OnCheckInsertFinalizePurchaseOrderHeaderOnBeforeCheckAddressDetails:END

Additional context

We have different logic for check Internal work item: AB#558154