-
Notifications
You must be signed in to change notification settings - Fork 436
Fix Incoming Documents default processed filter #9401
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TestIncomingDocsPreserveUnprocessedFilter does not actually prove that an explicit Processed=false filter is preserved rather than dropped: with the current implementation, both an explicit Processed=false external filter and no filter at all (the default-to-unprocessed path) produce an identical observable result in the handler (Processed=false, one row, ShowAll enabled, ShowUnprocessed disabled). The test therefore cannot distinguish 'filter preserved' from 'filter ignored and default applied,' so it does not add coverage beyond TestIncomingDocsDefaultToUnprocessed for that specific claim. Consider asserting something that only holds if the original filter object survived (for example, verifying no additional filter-group manipulation occurred, or restructuring so the preserved-filter case uses a value that would differ from the default outcome if broken). 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
||
| begin | ||
| VerifyIncomingDocumentsProcessedFilter(Format(false), false); | ||
| end; | ||
|
|
||
| [Test] | ||
| [Scope('OnPrem')] | ||
| procedure TestIncomingDocsShouldShowAllDocsOnShowAllAction() | ||
|
|
@@ -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"; | ||
|
|
@@ -2732,6 +2774,17 @@ codeunit 134400 "ERM Incoming Documents" | |
| IncomingDocuments.OK().Invoke(); | ||
| end; | ||
|
|
||
| [ModalPageHandler] | ||
| [Scope('OnPrem')] | ||
| procedure IncomingDocumentsProcessedFilterHandler(var IncomingDocuments: TestPage "Incoming Documents") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IncomingDocumentsProcessedFilterHandler hardcodes its expectations (row count, ShowAll.Enabled(), ShowUnprocessed.Enabled()) instead of having the calling test enqueue those expected values for the handler to dequeue and verify. Per BCQuality testing guidance, the test should own and enqueue the expected interaction state (including the enabled/disabled action states and expected row count) in call order, and the handler should only Dequeue and assert against that queued value — this makes handler/test mismatches explicit rather than baked into the handler, and keeps the three call sites (TestIncomingDocsDefaultToUnprocessed, TestIncomingDocsPreserveProcessedFilter, TestIncomingDocsPreserveUnprocessedFilter) from silently sharing hardcoded assumptions that don't vary per scenario. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
||
| 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") | ||
|
|
@@ -2870,4 +2923,3 @@ codeunit 134400 "ERM Incoming Documents" | |
| Assert.AreEqual(1, TempBlobList.Count(), NoOfAttachmentsSameErr); | ||
| end; | ||
| } | ||
|
|
||
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.
This changes the externally observable OnOpenPage behavior of shipped page 190 "Incoming Documents" for callers that pass an Incoming Document record with a non-empty Processed filter into Page.Run/Page.RunModal: SetProcessedDocumentsVisibility is now never invoked for that case, so the caller's data filter is preserved, but the ShowAll/ShowUnprocessed action Enabled state (driven by ShowAllDocsIsEnable) no longer reflects the actual applied filter — it stays at its unprocessed default (ShowAll enabled, ShowUnprocessed disabled) regardless of whether the incoming filter was Processed=true or Processed=false. External extensions that open this page with a custom filter and rely on the previous enabled-state derivation will see inconsistent action availability relative to the data actually shown. Note the new tests (TestIncomingDocsPreserveProcessedFilter/TestIncomingDocsPreserveUnprocessedFilter) explicitly assert this new fixed enabled-state, indicating it may be an accepted trade-off rather than an oversight, but it should be called out explicitly since it is a change in externally visible UI state contract, not just an internal filter fix.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4