microsoft / ALAppExtensions

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

[Event Modification] Codeunit 5988 "Serv-Documents Mgt." – OnCheckAndBlankQtysOnBeforeCheckServLine – Add IsHandled #26933

Closed Regatoni closed 1 month ago

Regatoni commented 1 month ago

Describe the request

[Event Modification] Codeunit 5988 "Serv-Documents Mgt." ??? OnCheckAndBlankQtysOnBeforeCheckServLine ??? Add IsHandled

Could you Add the "IsHandled" Pattern to the exsisting Event OnCheckAndBlankQtysOnBeforeCheckServLine and if IsHandled = true exclude the Checks on the Service Line?

procedure CheckAndBlankQtys(ServDocType: Integer)
    begin
        ServLine.Reset();
        OnCheckAndBlankQtysOnAfterServLineSetFilters(ServLine);
        if ServLine.Find('-') then
            repeat
// >>>>>>>>
                OnCheckAndBlankQtysOnBeforeCheckServLine(ServLine, IsHandled);
                if not IsHandled then begin
// >>>>>>>>
                // Service Charge line should not be tested.
                if (ServLine.Type <> ServLine.Type::" ") and not ServLine."System-Created Entry" then begin
                    if ServDocType = Database::"Service Contract Header" then
                        ServLine.TestField("Contract No.");
                    if ServDocType = Database::"Service Header" then
                        ServLine.TestField("Shipment No.");
                end;

                if (ServLine.Type = ServLine.Type::Item) and (ServLine."No." <> '') and (ServLine."Qty. Shipped (Base)" = 0) and (ServLine."Qty. Consumed (Base)" = 0) then
                    ServLine.TestField("Unit of Measure Code");
// >>>>>>>>
                end;
// >>>>>>>>
                if ServLine."Qty. per Unit of Measure" = 0 then              

Event:

    [IntegrationEvent(false, false)]
    local procedure OnCheckAndBlankQtysOnBeforeCheckServLine(var ServiceLine: Record "Service Line"; var IsHandled: Boolean)
    begin
    end;

Additional context

We are adding mutliple new LineTypes to the Service-Lines. We cannot Post Service Lines with a Service Contract because the Code checks for ServLine.Type <> ServLine.Type::" " before throwing an Error Internal work item: AB#543328

azure-boards[bot] commented 1 month ago

✅ Successfully linked to Azure Boards work item(s):

JesperSchulz commented 1 month 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: 22697.