-
Notifications
You must be signed in to change notification settings - Fork 692
[Enforced Digital Vouchers] - Attaching E-Documents when using Digital Vouchers #29793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GMatuleviciute
wants to merge
16
commits into
microsoft:main
Choose a base branch
from
GMatuleviciute:dev/aan/digitalvoucher
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1266f03
Adds E-Document support to digital voucher checks
AndriusAndrulevicius efdcbbe
Enforces feature checks for digital voucher attachments
AndriusAndrulevicius 3722878
Refactors E-Document attachment logic for vouchers
AndriusAndrulevicius 7a0e6d4
Adds E-Document attachment unit tests and refines checks
AndriusAndrulevicius 7e36e80
Update Apps/W1/EnforcedDigitalVouchers/app/src/EntrySetup/DigitalVouc…
AndriusAndrulevicius 9d7535b
Update Apps/W1/EnforcedDigitalVouchers/app/src/EntrySetup/DigitalVouc…
AndriusAndrulevicius 597bf71
Merge branch 'main' into dev/aan/digitalvoucher
AndriusAndrulevicius d935a24
Moves E-Document attachment logic to implementation layer
AndriusAndrulevicius 8b9bd7d
Revert Digital Voucher Entry Setup changes
GMatuleviciute 5264655
revert Digital Voucher Entry Setup changes
GMatuleviciute acc7cb2
Structure of codeunit 5579 "Digital Voucher Impl." update
GMatuleviciute c035881
Removed unnessasary empty line
GMatuleviciute 30dc167
Updated sequence of code in codeunit 5588 "Voucher E-Document Check" …
GMatuleviciute 42dee03
Adds telemetry logging for e-document attachment failures
AndriusAndrulevicius 6bd3ee1
add telemetry tags
ventselartur 818d91c
Improves telemetry error messages and permission set ordering
AndriusAndrulevicius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/VoucherEDocumentCheck.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.EServices.EDocument; | ||
|
|
||
| using System.Utilities; | ||
|
|
||
| codeunit 5588 "Voucher E-Document Check" implements "Digital Voucher Check" | ||
| { | ||
| Access = Internal; | ||
|
|
||
| /// <summary> | ||
| /// Validates that an E-Document is attached to the document before posting. | ||
| /// Only applies to Purchase Documents when the Digital Voucher feature is enabled and Check Type is set to E-Document. | ||
| /// </summary> | ||
| /// <param name="ErrorMessageMgt">Error message management for logging validation errors.</param> | ||
| /// <param name="DigitalVoucherEntryType">The type of digital voucher entry being validated.</param> | ||
| /// <param name="RecRef">Record reference to the document being validated.</param> | ||
| internal procedure CheckVoucherIsAttachedToDocument(var ErrorMessageMgt: Codeunit "Error Message Management"; DigitalVoucherEntryType: Enum "Digital Voucher Entry Type"; RecRef: RecordRef) | ||
| var | ||
| DigitalVoucherEntrySetup: Record "Digital Voucher Entry Setup"; | ||
| EDocument: Record "E-Document"; | ||
| DigitalVoucherFeature: Codeunit "Digital Voucher Feature"; | ||
| DigitalVoucherImpl: Codeunit "Digital Voucher Impl."; | ||
| NotPossibleToPostWithoutEDocumentErr: Label 'Not possible to post without linking an E-Document.'; | ||
| begin | ||
| if not DigitalVoucherFeature.IsFeatureEnabled() then | ||
| exit; | ||
|
|
||
| if DigitalVoucherEntryType <> DigitalVoucherEntryType::"Purchase Document" then | ||
| exit; | ||
|
|
||
| DigitalVoucherImpl.GetDigitalVoucherEntrySetup(DigitalVoucherEntrySetup, DigitalVoucherEntryType); | ||
| if DigitalVoucherEntrySetup."Check Type" <> DigitalVoucherEntrySetup."Check Type"::"E-Document" then | ||
| exit; | ||
|
|
||
| EDocument.SetRange("Document Record ID", RecRef.RecordId()); | ||
| if EDocument.IsEmpty() then begin | ||
| ErrorMessageMgt.LogSimpleErrorMessage(NotPossibleToPostWithoutEDocumentErr); | ||
| exit; | ||
| end; | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Generates a digital voucher for a posted document by delegating to the Attachment check type implementation. | ||
| /// This procedure retrieves the digital voucher entry setup and invokes the attachment-based voucher generation. | ||
| /// </summary> | ||
| /// <param name="DigitalVoucherEntryType">The type of digital voucher entry for the posted document.</param> | ||
| /// <param name="RecRef">Record reference to the posted document.</param> | ||
| internal procedure GenerateDigitalVoucherForPostedDocument(DigitalVoucherEntryType: Enum "Digital Voucher Entry Type"; RecRef: RecordRef) | ||
| var | ||
| DigitalVoucherEntrySetup: Record "Digital Voucher Entry Setup"; | ||
| DigitalVoucherImpl: Codeunit "Digital Voucher Impl."; | ||
| DigitalVoucherCheck: Interface "Digital Voucher Check"; | ||
| begin | ||
| DigitalVoucherImpl.GetDigitalVoucherEntrySetup(DigitalVoucherEntrySetup, DigitalVoucherEntryType); | ||
| DigitalVoucherCheck := DigitalVoucherEntrySetup."Check Type"::Attachment; | ||
| DigitalVoucherCheck.GenerateDigitalVoucherForPostedDocument(DigitalVoucherEntrySetup."Entry Type", RecRef); | ||
| end; | ||
| } |
14 changes: 14 additions & 0 deletions
14
Apps/W1/EnforcedDigitalVouchers/digital-voucher.code-workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "app" | ||
| }, | ||
| { | ||
| "path": "test" | ||
| }, | ||
| { | ||
| "path": "test library" | ||
| } | ||
| ], | ||
| "settings": {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.