-
Notifications
You must be signed in to change notification settings - Fork 318
[Quality Management] - Mixed Responsibilities in Helper Codeunits #5944
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
tomasevicst
wants to merge
5
commits into
main
Choose a base branch
from
private/stomasevic/611502_QM_Mixed_Responsibilities_in_Helper_Codeunit
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
5 commits
Select commit
Hold shift + click to select a range
50cce2b
[Quality Management] Refactor localization handling for boolean value…
tomasevicst 151e997
[Quality Management] Remove ParseFromUser procedure for boolean value…
tomasevicst ca9582a
[Quality Management] Refactor quality management helpers to use Qlty.…
tomasevicst 8885a97
[Quality Management] Refactor quality management helpers to use Qlty.…
tomasevicst b3810bf
Merge branch 'main' into private/stomasevic/611502_QM_Mixed_Responsib…
tomasevicst 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
62 changes: 62 additions & 0 deletions
62
src/Apps/W1/Quality Management/app/src/Utilities/QltyConfigurationHelpers.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,62 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.QualityManagement.Utilities; | ||
|
|
||
| using Microsoft.QualityManagement.Setup; | ||
|
|
||
| codeunit 20597 "Qlty. Configuration Helpers" | ||
| { | ||
| /// <summary> | ||
| /// The maximum recursion to use when creating inspections. | ||
| /// Used for traversal on source table configuration when finding applicable generation rules, and also when populating source fields. | ||
| /// | ||
| /// This limit prevents infinite loops in complex configuration hierarchies and ensures reasonable performance | ||
| /// when traversing multi-level table relationships. | ||
| /// </summary> | ||
| /// <returns>The maximum recursion depth allowed (currently 20 levels)</returns> | ||
| procedure GetArbitraryMaximumRecursion(): Integer | ||
| begin | ||
| exit(20); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Returns the maximum number of rows to show in field lookup dialogs. | ||
| /// Uses setup configuration if defined, otherwise defaults to 100. | ||
| /// | ||
| /// Lookup order: | ||
| /// 1. OnBeforeGetDefaultMaximumRowsToShowInLookup event (if handled) | ||
| /// 2. Qlty. Management Setup."Max Rows Field Lookups" (if > 0) | ||
| /// 3. Default value of 100 | ||
| /// </summary> | ||
| /// <returns>Maximum number of rows for field lookups</returns> | ||
| procedure GetDefaultMaximumRowsFieldLookup() ResultRowsCount: Integer | ||
| var | ||
| QltyManagementSetup: Record "Qlty. Management Setup"; | ||
| Handled: Boolean; | ||
| begin | ||
| ResultRowsCount := 100; | ||
| OnBeforeGetDefaultMaximumRowsToShowInLookup(ResultRowsCount, Handled); | ||
| if Handled then | ||
| exit; | ||
|
|
||
| if not QltyManagementSetup.GetSetupRecord() then | ||
| exit; | ||
|
|
||
| if QltyManagementSetup."Max Rows Field Lookups" > 0 then | ||
| ResultRowsCount := QltyManagementSetup."Max Rows Field Lookups"; | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Provides an opportunity for customizations to alter the default maximum rows shown | ||
| /// for a table lookup in a quality inspector field. | ||
| /// Changing the default to a larger number can introduce performance issues. | ||
| /// </summary> | ||
| /// <param name="Rows">The number of rows to show</param> | ||
| /// <param name="Handled">Set to true if the event was handled</param> | ||
| [IntegrationEvent(false, false)] | ||
| local procedure OnBeforeGetDefaultMaximumRowsToShowInLookup(var Rows: Integer; var Handled: Boolean) | ||
| begin | ||
| end; | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/Apps/W1/Quality Management/app/src/Utilities/QltyFileImport.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,27 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.QualityManagement.Utilities; | ||
|
|
||
| codeunit 20596 "Qlty. File Import" | ||
| { | ||
| var | ||
| ImportFromLbl: Label 'Import From File'; | ||
|
|
||
| /// <summary> | ||
| /// Prompts the user to select a file and imports its contents into an InStream for processing. | ||
| /// Displays a file upload dialog with optional file type filtering. | ||
| /// | ||
| /// Common usage: Importing configuration files, test data, or external quality inspection results. | ||
| /// </summary> | ||
| /// <param name="FilterString">File type filter for the upload dialog (e.g., "*.xml|*.txt")</param> | ||
| /// <param name="InStream">Output: InStream containing the uploaded file contents</param> | ||
| /// <returns>True if file was successfully selected and uploaded; False if user cancelled or upload failed</returns> | ||
| procedure PromptAndImportIntoInStream(FilterString: Text; var InStream: InStream): Boolean | ||
| var | ||
| ServerFile: Text; | ||
| begin | ||
| exit(UploadIntoStream(ImportFromLbl, '', FilterString, ServerFile, InStream)); | ||
| end; | ||
| } |
44 changes: 44 additions & 0 deletions
44
src/Apps/W1/Quality Management/app/src/Utilities/QltyLocalization.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,44 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.QualityManagement.Utilities; | ||
|
|
||
| codeunit 20598 "Qlty. Localization" | ||
| { | ||
| var | ||
| TranslatableYesLbl: Label 'Yes'; | ||
| TranslatableNoLbl: Label 'No'; | ||
|
|
||
| /// <summary> | ||
| /// Returns the translatable "Yes" label with maximum length of 250 characters. | ||
| /// Used for UI display and user-facing text where localization is required. | ||
| /// </summary> | ||
| /// <returns>The localized "Yes" text (up to 250 characters)</returns> | ||
| procedure GetTranslatedYes(): Text[250] | ||
| begin | ||
| exit(TranslatableYesLbl); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Returns the translatable "No" label with maximum length of 250 characters. | ||
| /// Used for UI display and user-facing text where localization is required. | ||
| /// </summary> | ||
| /// <returns>The localized "No" text (up to 250 characters)</returns> | ||
| procedure GetTranslatedNo(): Text[250] | ||
| begin | ||
| exit(TranslatableNoLbl); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Formats a boolean value for user display using localized Yes/No text. | ||
| /// </summary> | ||
| /// <param name="Value">The boolean value to format</param> | ||
| /// <returns>Localized "Yes" for true, "No" for false</returns> | ||
| procedure FormatForUser(Value: Boolean): Text[250] | ||
| begin | ||
| if Value then | ||
| exit(TranslatableYesLbl); | ||
| exit(TranslatableNoLbl); | ||
| end; | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we keep this pattern? We don't use it in base app, we just rely on regular labels directly in the codeunit that needs them