microsoft / ALAppExtensions

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

[Event Request] codeunit 99000830 "Create Reserv. Entry" - CheckValidity #20928

Closed sschuh closed 1 year ago

sschuh commented 1 year ago

hi,

please add following event in object codeunit 99000830 "Create Reserv. Entry" function "CheckValidity":


    local procedure CheckValidity(var ReservEntry: Record "Reservation Entry")
    var
        IsError: Boolean;
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeCheckValidity(ReservEntry, IsHandled);
        if IsHandled then
            exit;

        if ReservEntry."Reservation Status" <> ReservEntry."Reservation Status"::Reservation then
            exit;

        case ReservEntry."Source Type" of
            DATABASE::"Sales Line":
                IsError := not (ReservEntry."Source Subtype" in [1, 5]);
            DATABASE::"Purchase Line":
                IsError := not (ReservEntry."Source Subtype" in [1, 5]);
            DATABASE::"Prod. Order Line",
          DATABASE::"Prod. Order Component":
                IsError := (ReservEntry."Source Subtype" = 4) or
                  ((ReservEntry."Source Subtype" = 1) and (ReservEntry.Binding = ReservEntry.Binding::" "));
            DATABASE::"Assembly Header",
          DATABASE::"Assembly Line":
                IsError := not (ReservEntry."Source Subtype" = 1); // Only Assembly Order supported
            DATABASE::"Requisition Line",
          DATABASE::"Planning Component":
                IsError := ReservEntry.Binding = ReservEntry.Binding::" ";
            DATABASE::"Item Journal Line":
                // Item Journal Lines with Entry Type Transfer can carry reservations during posting:
                IsError := (ReservEntry."Source Subtype" <> 4) and
                  (ReservEntry."Source Ref. No." <> 0);
            DATABASE::"Job Journal Line":
                IsError := ReservEntry.Binding = ReservEntry.Binding::"Order-to-Order";
            DATABASE::"Job Planning Line":
                IsError := ReservEntry."Source Subtype" <> 2;
            else
                OnAfterCheckValidity(ReservEntry, IsError);
        end;

    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    OnAfterCheckValidityOnBeforeIsError(ReservEntry, IsError);
    // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        if IsError then
            Error(Text000);
    end;

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    [IntegrationEvent(false, false)]
    local procedure OnAfterCheckValidityOnBeforeIsError(var ReservationEntry: Record "Reservation Entry"; var IsError: Boolean)
    begin
    end;
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

thank you!

JesperSchulz commented 1 year 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: 49559.