Skip to content

[Event Request] Codeunit 5887 "Phys. Invt.-Calc. Qty. All".OnRun #29832

@fridrichovsky

Description

@fridrichovsky

Why do you need this change?

We need skip standard strmenu, bucause we use this codeunit during API actions. It means we have to skip all users interactive parts. This event allow us skip selecetion menu and provide default selection set in setups or provided by API.

New event doesn't skip another events so this not change behavior for another extensions.

Describe the request

    trigger OnRun()
    var
        PhysInvtOrderHeader: Record "Phys. Invt. Order Header";
        PhysInvtOrderLine: Record "Phys. Invt. Order Line";
        Selection: Integer;
        //-----------------------------OnRunOnBeforeSelectSelection:BEGIN
        IsHandled: Boolean;
        //-----------------------------OnRunOnBeforeSelectSelection:END
    begin
        PhysInvtOrderHeader.Copy(Rec);

        //-----------------------------OnRunOnBeforeSelectSelection:BEGIN
        IsHandled := false;
        OnRunOnBeforeSelectSelection(Selection, IsHandled);
        if not IsHandled then
        //-----------------------------OnRunOnBeforeSelectSelection:END
          Selection := StrMenu(SelectionQst, 1);
        if Selection = 0 then
            exit;

        PhysInvtOrderLine.Reset();
        PhysInvtOrderLine.SetRange("Document No.", PhysInvtOrderHeader."No.");
        if PhysInvtOrderLine.Find('-') then
            repeat
                if (Selection = 1) or
                   ((Selection = 2) and not PhysInvtOrderLine."Qty. Exp. Calculated")
                then
                    if not PhysInvtOrderLine.EmptyLine() then begin
                        PhysInvtOrderLine.TestField("Item No.");
                        PhysInvtOrderLine.CalcQtyAndTrackLinesExpected();
                        PhysInvtOrderLine.Modify();
                    end;
            until PhysInvtOrderLine.Next() = 0;

        Rec := PhysInvtOrderHeader;
    end;

    var
        SelectionQst: Label 'All Order Lines,Only Not Calculated Lines';

    //-----------------------------OnRunOnBeforeSelectSelection:BEGIN
    [IntegrationEvent(false, false)]
    local procedure OnRunOnBeforeSelectSelection(var Selection: Integer; var IsHandled: Boolean)
    begin
    end;
    //-----------------------------OnRunOnBeforeSelectSelection:END

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions