Codeunit 20567 Subc. Pst. Prev. Event Handler
src/Apps/W1/Subcontracting/App/src/WIPItem/SubcPstPrevEventHandler.Codeunit.al64 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.Manufacturing.Subcontracting;codeunit 20567 "Subc. Pst. Prev. Event Handler"{ EventSubscriberInstance = Manual; SingleInstance = true; var TempSubcontractorWIPLedgerEntry: Record "Subcontractor WIP Ledger Entry" temporary;#if not CLEAN29#pragma warning disable AL0432 SubcFeatureFlagHandler: Codeunit "Subc. Feature Flag Handler";#pragma warning restore AL0432#endif DocumentMaskTok: Label '***', Locked = true; [EventSubscriber(ObjectType::Table, Database::"Subcontractor WIP Ledger Entry", OnAfterInsertEvent, '', false, false)] local procedure OnInsertWIPEntry(var Rec: Record "Subcontractor WIP Ledger Entry") begin#if not CLEAN29#pragma warning disable AL0432 if not SubcFeatureFlagHandler.IsSubcontractingEnabled() then#pragma warning restore AL0432 exit;#endif if Rec.IsTemporary() then exit; if TempSubcontractorWIPLedgerEntry.Get(Rec."Entry No.") then exit; TempSubcontractorWIPLedgerEntry := Rec; TempSubcontractorWIPLedgerEntry."Document No." := DocumentMaskTok; TempSubcontractorWIPLedgerEntry.Insert(); end; procedure DeleteAll() begin#if not CLEAN29#pragma warning disable AL0432 if not SubcFeatureFlagHandler.IsSubcontractingEnabled() then#pragma warning restore AL0432 exit;#endif TempSubcontractorWIPLedgerEntry.Reset(); TempSubcontractorWIPLedgerEntry.DeleteAll(); end; procedure GetTempSubcontractorWIPLedgerEntry(var OutTempSubcontractorWIPLedgerEntry: Record "Subcontractor WIP Ledger Entry" temporary) begin#if not CLEAN29#pragma warning disable AL0432 if not SubcFeatureFlagHandler.IsSubcontractingEnabled() then#pragma warning restore AL0432 exit;#endif OutTempSubcontractorWIPLedgerEntry.Copy(TempSubcontractorWIPLedgerEntry, true); end;}