ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 5406 "Prod. Order Line" - procedure DeleteRelations()

Open jlorenc01 opened this issue 3 years ago • 1 comments

Hi there,

I would like to ask for a new publisher in the table 5406 Prod. Order Line", procedure DeleteRelations(). We need to skip deletion of Prod. Order Routing Lines. Similar subscriber is a little bit below in DeleteRelations() for skipping deletion of Prod. Order Components:

procedure DeleteRelations()
var
    ProdOrderComp: Record "Prod. Order Component";
    ProdOrderRoutingLine: Record "Prod. Order Routing Line";
    IsHandled: Boolean;
...
begin
    OnBeforeDeleteRelations(Rec);

    ProdOrderLine.SetRange(Status, Status);
    ProdOrderLine.SetRange("Prod. Order No.", "Prod. Order No.");
    ProdOrderLine.SetRange("Routing No.", "Routing No.");
    ProdOrderLine.SetFilter("Line No.", '<>%1', "Line No.");
    ProdOrderLine.SetRange("Routing Reference No.", "Routing Reference No.");
    if not ProdOrderLine.FindFirst() then begin
        ProdOrderRoutingLine.SetRange(Status, Status);
        ProdOrderRoutingLine.SetRange("Prod. Order No.", "Prod. Order No.");
        ProdOrderRoutingLine.SetRange("Routing No.", "Routing No.");
        ProdOrderRoutingLine.SetRange("Routing Reference No.", "Routing Reference No.");
        if ProdOrderRoutingLine.FindSet(true) then
            repeat
                ProdOrderRoutingLine.SetSkipUpdateOfCompBinCodes(true);
                IsHandled := false;
                OnDeleteRelationsOnBeforeProdOrderRoutingLineDelete(ProdOrderRoutingLine, IsHandled); // NEW EVENT
                if not IsHandled then
                    ProdOrderRoutingLine.Delete(true);
            until ProdOrderRoutingLine.Next() = 0;
    end;

    ProdOrderComp.Reset();
    ProdOrderComp.SetRange(Status, Status);
    ProdOrderComp.SetRange("Prod. Order No.", "Prod. Order No.");
    ProdOrderComp.SetRange("Prod. Order Line No.", "Line No.");
    IsHandled := false;
    OnDeleteRelationsOnBeforeProdOrderCompDeleteAll(ProdOrderComp, Blocked, IsHandled);
    if not IsHandled then
        ProdOrderComp.DeleteAll(true);
...
end;
[IntegrationEvent(false, false)]
local procedure OnDeleteRelationsOnBeforeProdOrderRoutingLineDelete(var ProdOrderComp: Record "Prod. Order Component"; var IsHandled: Boolean)
begin
end;

jlorenc01 avatar May 04 '23 06:05 jlorenc01

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

JesperSchulz avatar May 09 '23 15:05 JesperSchulz