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 @@ -800,8 +800,8 @@ page 190 "Incoming Documents"
UpdateOCRSetupVisibility();

Rec.FilterGroup(0);
if Rec.GetFilter(Processed) <> '' then
SetProcessedDocumentsVisibility(Rec.GetFilter(Processed) = Format(true));
if Rec.GetFilter(Processed) = '' then
Comment thread
JesperSchulz marked this conversation as resolved.
SetProcessedDocumentsVisibility(false);
end;

var
Expand Down Expand Up @@ -937,4 +937,3 @@ page 190 "Incoming Documents"
begin
end;
}

54 changes: 53 additions & 1 deletion src/Layers/W1/Tests/ERM/ERMIncomingDocuments.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,30 @@ codeunit 134400 "ERM Incoming Documents"
IncomingDocument.HyperlinkToDocument(DocumentNo, PostingDate);
end;

[Test]
[HandlerFunctions('IncomingDocumentsProcessedFilterHandler')]
[Scope('OnPrem')]
procedure TestIncomingDocsDefaultToUnprocessed()
begin
VerifyIncomingDocumentsProcessedFilter('', false);
end;

[Test]
[HandlerFunctions('IncomingDocumentsProcessedFilterHandler')]
[Scope('OnPrem')]
procedure TestIncomingDocsPreserveProcessedFilter()
begin
VerifyIncomingDocumentsProcessedFilter(Format(true), true);
end;

[Test]
[HandlerFunctions('IncomingDocumentsProcessedFilterHandler')]
[Scope('OnPrem')]
procedure TestIncomingDocsPreserveUnprocessedFilter()
Comment thread
JesperSchulz marked this conversation as resolved.
begin
VerifyIncomingDocumentsProcessedFilter(Format(false), false);
end;

[Test]
[Scope('OnPrem')]
procedure TestIncomingDocsShouldShowAllDocsOnShowAllAction()
Expand Down Expand Up @@ -2181,6 +2205,24 @@ codeunit 134400 "ERM Incoming Documents"
Assert.AreEqual(DataExchangeTypeHasValue, IncomingDocuments.CreateDocument.Enabled(), 'Editable value unexpected.');
end;

local procedure VerifyIncomingDocumentsProcessedFilter(ProcessedFilter: Text; ExpectedProcessed: Boolean)
var
IncomingDocument: Record "Incoming Document";
begin
IncomingDocument.DeleteAll();
CreateIncomingDocument(IncomingDocument, 'Processed Document', true);
CreateIncomingDocument(IncomingDocument, 'Unprocessed Document', false);

IncomingDocument.Reset();
if ProcessedFilter <> '' then
IncomingDocument.SetFilter(Processed, ProcessedFilter);

LibraryVariableStorage.Clear();
LibraryVariableStorage.Enqueue(ExpectedProcessed);
Page.RunModal(Page::"Incoming Documents", IncomingDocument);
LibraryVariableStorage.AssertEmpty();
end;

local procedure GetIncomeStatementAcc(): Code[20]
var
GLAccount: Record "G/L Account";
Expand Down Expand Up @@ -2732,6 +2774,17 @@ codeunit 134400 "ERM Incoming Documents"
IncomingDocuments.OK().Invoke();
end;

[ModalPageHandler]
[Scope('OnPrem')]
procedure IncomingDocumentsProcessedFilterHandler(var IncomingDocuments: TestPage "Incoming Documents")
Comment thread
JesperSchulz marked this conversation as resolved.
begin
IncomingDocuments.Processed.AssertEquals(LibraryVariableStorage.DequeueBoolean());
Assert.IsFalse(IncomingDocuments.Next(), 'Expected the page to contain one incoming document.');
Assert.IsTrue(IncomingDocuments.ShowAll.Enabled(), 'Expected Show All to be enabled for a filtered view.');
Assert.IsFalse(IncomingDocuments.ShowUnprocessed.Enabled(), 'Expected Show Unprocessed to be disabled for a filtered view.');
IncomingDocuments.OK().Invoke();
end;

[PageHandler]
[Scope('OnPrem')]
procedure IncomingDocumentCardHandler(var IncomingDocumentCard: TestPage "Incoming Document")
Expand Down Expand Up @@ -2870,4 +2923,3 @@ codeunit 134400 "ERM Incoming Documents"
Assert.AreEqual(1, TempBlobList.Count(), NoOfAttachmentsSameErr);
end;
}

Loading