Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ table 20411 "Qlty. Inspection Result"
field(10; "Default Number Condition"; Text[500])
{
Caption = 'Default Number Condition';
NotBlank = true;
ToolTip = 'Specifies the default condition of when this result is activated.';

trigger OnValidate()
Expand All @@ -76,7 +75,6 @@ table 20411 "Qlty. Inspection Result"
field(11; "Default Text Condition"; Text[500])
{
Caption = 'Default Text Condition';
NotBlank = false;
ToolTip = 'Specifies the default condition of when this result is activated.';

trigger OnValidate()
Expand All @@ -92,7 +90,6 @@ table 20411 "Qlty. Inspection Result"
field(12; "Default Boolean Condition"; Text[500])
{
Caption = 'Default Boolean Condition';
NotBlank = false;
ToolTip = 'Specifies the default condition of when this result is activated.';

trigger OnValidate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ page 20416 "Qlty. Inspection Result List"
}
field("Copy Behavior"; Rec."Copy Behavior")
{
Visible = false;
}
field("Result Visibility"; Rec."Result Visibility")
{
Expand Down Expand Up @@ -130,8 +131,8 @@ page 20416 "Qlty. Inspection Result List"
action(CopyResultsToAllTemplates)
{
ApplicationArea = QualityManagement;
Caption = 'Copy Results to Existing Templates';
ToolTip = 'Use this to add newly created results configured to Automatically Copy on to existing tests and existing templates.';
Caption = 'Update Tests, Templates, and Inspections';
ToolTip = 'Adds newly created results to existing quality tests and templates, adjusts evaluation sequences, and updates promoted results. Inspections based on these templates are also updated.';
Image = Copy;

trigger OnAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ using Microsoft.QualityManagement.Configuration.Template;
using Microsoft.QualityManagement.Configuration.Template.Test;
using Microsoft.QualityManagement.Document;
using Microsoft.QualityManagement.Utilities;
using System.Utilities;

/// <summary>
/// Used to copy result conditions from tests to templates, templates to inspections
/// </summary>
codeunit 20409 "Qlty. Result Condition Mgmt."
{
var
ConfirmManagement: Codeunit "Confirm Management";
ChangedTestConditionsUpdateTemplatesQst: Label 'You have changed default conditions on the test %2, there are %1 template lines with earlier conditions for this result. Do you want to update the templates?', Comment = '%1=the amount of template lines that have other conditions, %2=the test name';
ChangedResultConditionsUpdateDefaultsOnTestsQst: Label 'You have changed default conditions on the result %1, there are %2 tests with earlier conditions for this result. Do you want to update these tests?', Comment = '%1=the amount of tests that have other conditions, %2=the result name';
UpdateResultsOnTestsTemplatesInspectionsQst: Label 'This will insert new results and adjust evaluation sequence on existing results on all templates, tests, and inspections. Do you want to continue?';

/// <summary>
/// Prompts if templates should be updated.
Expand All @@ -26,7 +29,6 @@ codeunit 20409 "Qlty. Result Condition Mgmt."
var
CountsQltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
CopyToQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
Continue: Boolean;
begin
CountsQltyInspectionTemplateLine.SetRange("Test Code", CopyFromQltyIResultConditConf."Test Code");

Expand All @@ -39,12 +41,10 @@ codeunit 20409 "Qlty. Result Condition Mgmt."
CopyToQltyIResultConditConf.SetRange(Condition);
CopyToQltyIResultConditConf.SetFilter("Condition Description", '<>%1', CopyFromQltyIResultConditConf."Condition Description");
end;
if not CopyToQltyIResultConditConf.IsEmpty() then begin
if not GuiAllowed() then
Continue := true
else
Continue := Confirm(StrSubstNo(ChangedTestConditionsUpdateTemplatesQst, CountsQltyInspectionTemplateLine.Count(), CopyFromQltyIResultConditConf."Test Code"));
if Continue then begin
if not CopyToQltyIResultConditConf.IsEmpty() then
if ConfirmManagement.GetResponseOrDefault(
StrSubstNo(ChangedTestConditionsUpdateTemplatesQst, CountsQltyInspectionTemplateLine.Count(), CopyFromQltyIResultConditConf."Test Code"))
then begin
CopyToQltyIResultConditConf.FindSet(true);
repeat
CopyResultConditionsFromTestToTemplateLine(
Expand All @@ -56,24 +56,19 @@ codeunit 20409 "Qlty. Result Condition Mgmt."
CopyFromQltyIResultConditConf."Condition Description");
until CopyToQltyIResultConditConf.Next() = 0;
end;
end;
end;

internal procedure PromptUpdateTestsFromResultIfApplicable(ResultCode: Code[20])
var
ExistingQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
Continue: Boolean;
begin
ExistingQltyIResultConditConf.SetRange("Result Code", ResultCode);
ExistingQltyIResultConditConf.SetRange("Condition Type", ExistingQltyIResultConditConf."Condition Type"::Test);
if not ExistingQltyIResultConditConf.IsEmpty() then begin
if not GuiAllowed() then
Continue := true
else
Continue := Confirm(StrSubstNo(ChangedResultConditionsUpdateDefaultsOnTestsQst, ResultCode, ExistingQltyIResultConditConf.Count()));
if Continue then
if not ExistingQltyIResultConditConf.IsEmpty() then
if ConfirmManagement.GetResponseOrDefault(
StrSubstNo(ChangedResultConditionsUpdateDefaultsOnTestsQst, ResultCode, ExistingQltyIResultConditConf.Count()))
then
OverwriteExistingTestConditionsWithResultCondition(ResultCode);
end;
end;

/// <summary>
Expand Down Expand Up @@ -248,6 +243,9 @@ codeunit 20409 "Qlty. Result Condition Mgmt."
QltyInspectionResult: Record "Qlty. Inspection Result";
QltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
begin
if not ConfirmManagement.GetResponseOrDefault(UpdateResultsOnTestsTemplatesInspectionsQst) then
exit;

QltyInspectionResult.SetRange("Copy Behavior", QltyInspectionResult."Copy Behavior"::"Automatically copy the result");
if QltyInspectionResult.FindSet() then
repeat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ codeunit 139956 "Qlty. Tests - Result Condition"
end;

[Test]
[HandlerFunctions('PromptUpdateTestsFromResultConfirmHandler_True')]
procedure CopyResultConditionsFromDefaultToAllTemplates_WithNewTestConfiguredToCopy()
var
ConditionalQltyInspectionResult: Record "Qlty. Inspection Result";
Expand Down
Loading