From 852a71a159c09f4e03c88726d155c0d7aac67dd1 Mon Sep 17 00:00:00 2001 From: Stig Killendahl Date: Mon, 15 Apr 2024 15:39:45 +0200 Subject: [PATCH] Add state enum --- .../App/Document Sharing/app.json | 2 +- .../src/DocumentSharing.Table.al | 5 ++-- .../src/DocumentSharingImpl.Codeunit.al | 2 +- .../src/DocumentSharingState.Enum.al | 30 +++++++++++++++++++ .../src/WordTemplateImpl.Codeunit.al | 2 +- 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 src/System Application/App/Document Sharing/src/DocumentSharingState.Enum.al diff --git a/src/System Application/App/Document Sharing/app.json b/src/System Application/App/Document Sharing/app.json index d077688842..3f3d6f47d9 100644 --- a/src/System Application/App/Document Sharing/app.json +++ b/src/System Application/App/Document Sharing/app.json @@ -47,7 +47,7 @@ "idRanges": [ { "from": 9560, - "to": 9562 + "to": 9563 } ], "contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/" diff --git a/src/System Application/App/Document Sharing/src/DocumentSharing.Table.al b/src/System Application/App/Document Sharing/src/DocumentSharing.Table.al index 717bea1f42..b4fa4be09e 100644 --- a/src/System Application/App/Document Sharing/src/DocumentSharing.Table.al +++ b/src/System Application/App/Document Sharing/src/DocumentSharing.Table.al @@ -123,11 +123,12 @@ table 9560 "Document Sharing" } /// - /// Specifies whether the action was cancelled. + /// Specifies the state of the document sharing operation. /// - field(13; Cancelled; Boolean) + field(13; State; Enum "Document Sharing State") { DataClassification = SystemMetadata; + InitValue = Success; } } diff --git a/src/System Application/App/Document Sharing/src/DocumentSharingImpl.Codeunit.al b/src/System Application/App/Document Sharing/src/DocumentSharingImpl.Codeunit.al index 6ece4d4185..7e95edac40 100644 --- a/src/System Application/App/Document Sharing/src/DocumentSharingImpl.Codeunit.al +++ b/src/System Application/App/Document Sharing/src/DocumentSharingImpl.Codeunit.al @@ -135,7 +135,7 @@ codeunit 9561 "Document Sharing Impl." Sleep(2000); // This sleep is to ensure the OneDrive clears the lock on the file after the user saves and closes. DocumentSharingCodeunit.OnGetFileContents(DocumentSharing, Handled); end else - DocumentSharing.Cancelled := true; + DocumentSharing.State := DocumentSharing.State::Cancelled; Handled := false; DocumentSharingCodeunit.OnDeleteDocument(DocumentSharing, Handled); diff --git a/src/System Application/App/Document Sharing/src/DocumentSharingState.Enum.al b/src/System Application/App/Document Sharing/src/DocumentSharingState.Enum.al new file mode 100644 index 0000000000..4400237e5a --- /dev/null +++ b/src/System Application/App/Document Sharing/src/DocumentSharingState.Enum.al @@ -0,0 +1,30 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace System.Integration; + +/// +/// The result of the sharing operation. +/// +enum 9563 "Document Sharing State" +{ + Extensible = false; + + /// + /// Operation completed successfully. + /// + value(0; Success) + { + Caption = 'Success'; + } + + /// + /// Operation cancelled. + /// + value(1; Cancelled) + { + Caption = 'Cancelled'; + } +} \ No newline at end of file diff --git a/src/System Application/App/Word Templates/src/WordTemplateImpl.Codeunit.al b/src/System Application/App/Word Templates/src/WordTemplateImpl.Codeunit.al index 15997f89cd..aca6724acb 100644 --- a/src/System Application/App/Word Templates/src/WordTemplateImpl.Codeunit.al +++ b/src/System Application/App/Word Templates/src/WordTemplateImpl.Codeunit.al @@ -610,7 +610,7 @@ codeunit 9988 "Word Template Impl." DocumentSharing.Share(TempDocumentSharing); - if TempDocumentSharing.Cancelled then + if TempDocumentSharing.State = TempDocumentSharing.State::Cancelled then Error(''); ResultTempBlob.CreateOutStream(OutStream, TextEncoding::UTF8);