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 @@ -41,6 +41,8 @@ codeunit 304 "No. Series - Impl."
NoSeries: Record "No. Series";
NoSeriesErrorsImpl: Codeunit "No. Series - Errors Impl.";
begin
if NoSeriesCode = '' then
exit;
NoSeries.Get(NoSeriesCode);
if not NoSeries."Manual Nos." then
NoSeriesErrorsImpl.Throw(ErrorText, NoSeriesCode, NoSeriesErrorsImpl.OpenNoSeriesLinesAction());
Expand Down Expand Up @@ -275,17 +277,17 @@ codeunit 304 "No. Series - Impl."
NoSeries: Record "No. Series";
NoSeriesRelationship: Record "No. Series Relationship";
begin
NoSeriesRelationship.SetRange(Code, OriginalNoSeriesCode);
if NoSeriesRelationship.FindSet() then
repeat
NoSeries.Code := NoSeriesRelationship."Series Code";
NoSeries.Mark := true;
until NoSeriesRelationship.Next() = 0;

// Mark the original series
NoSeries.Code := OriginalNoSeriesCode;
NoSeries.Mark := true;
NoSeries.MarkedOnly := true;
NoSeriesRelationship.SetRange(Code, OriginalNoSeriesCode);
if NoSeriesRelationship.FindSet() then
repeat
NoSeries.Code := NoSeriesRelationship."Series Code";
NoSeries.Mark := true;
until NoSeriesRelationship.Next() = 0;

// Mark the original series
NoSeries.Code := OriginalNoSeriesCode;
NoSeries.Mark := true;
NoSeries.MarkedOnly := true;

// If DefaultHighlightedNoSeriesCode is set, make sure we select it by default on the page
if DefaultHighlightedNoSeriesCode <> '' then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,35 @@ codeunit 134530 "No. Series Tests"
Assert.AreEqual('', NoSeries.GetLastNoUsed(''), 'GetLastNoUsed should return empty code if argument supplied is empty code');
end;

[Test]
procedure TestManualShouldAllowBlankNoSeriesCode()
var
NoSeriesCU: Codeunit "No. Series";
begin
// [SCENARIO] TestManual should allow blank No. Series Code to enable users to enter manual numbers
// when no number series is configured in the setup page.
Initialize();

// [GIVEN] No number series is configured (empty code)
// [WHEN] TestManual is called with blank code
// [THEN] No error should be thrown - blank codes indicate manual entry is allowed
NoSeriesCU.TestManual('');
end;

[Test]
procedure TestManualWithDocNoShouldAllowBlankNoSeriesCode()
var
NoSeriesCU: Codeunit "No. Series";
begin
// [SCENARIO] TestManual with DocumentNo should allow blank No. Series Code
Initialize();

// [GIVEN] No number series is configured (empty code)
// [WHEN] TestManual is called with blank code and a document number
// [THEN] No error should be thrown
NoSeriesCU.TestManual('', 'MANUAL-001');
end;

[Test]
[HandlerFunctions('NoSeriesLinesPageHandler')]
procedure TestEditNoSeriesLinePreservesFilter()
Expand Down
Loading