Skip to content
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

No. Series: Ability to extend filters on finding No. Series Lines when getting new numbers #2361

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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 @@ -88,7 +88,7 @@ codeunit 305 "No. Series - Setup Impl."
NoSeries.MarkedOnly(true);
end;

local procedure SetNoSeriesCurrentLineFilters(var NoSeriesRec: Record "No. Series"; var NoSeriesLine: Record "No. Series Line"; ResetForDrillDown: Boolean)
procedure SetNoSeriesCurrentLineFilters(var NoSeriesRec: Record "No. Series"; var NoSeriesLine: Record "No. Series Line"; ResetForDrillDown: Boolean)
grobyns marked this conversation as resolved.
Show resolved Hide resolved
PeterDurrer marked this conversation as resolved.
Show resolved Hide resolved
var
NoSeries: Codeunit "No. Series";
#if not CLEAN24
Expand All @@ -98,9 +98,7 @@ codeunit 305 "No. Series - Setup Impl."
#endif
begin
NoSeriesLine.Reset();
NoSeriesLine.SetCurrentKey("Series Code", "Starting Date");
NoSeriesLine.SetRange("Series Code", NoSeriesRec.Code);
NoSeriesLine.SetRange("Starting Date", 0D, WorkDate());
GetNoSeriesLineFilters(NoSeriesLine, NoSeriesRec.Code, WorkDate());
#if not CLEAN24
#pragma warning disable AL0432
NoSeriesManagement.RaiseObsoleteOnNoSeriesLineFilterOnBeforeFindLast(NoSeriesLine);
Expand Down Expand Up @@ -137,6 +135,23 @@ codeunit 305 "No. Series - Setup Impl."
exit(NoSeriesSingle.MayProduceGaps());
end;

local procedure GetNoSeriesLineFilters(var NoSeriesLine: Record "No. Series Line"; NoSeriesCode: Code[20]; StartingDate: Date)
grobyns marked this conversation as resolved.
Show resolved Hide resolved
var
NoSeries: Codeunit "No. Series";
NoSeriesLine2: Record "No. Series Line";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See errors below, basically the sorting of variables must be fixed, Record comes before codeunit.

CodeFieldChangedErr: Label 'Change of Series Code Field is on this Record not allowed.';
grobyns marked this conversation as resolved.
Show resolved Hide resolved
begin
NoSeriesLine2.SetCurrentKey("Series Code", "Starting Date");
NoSeriesLine2.SetRange("Starting Date", 0D, StartingDate);
NoSeriesLine2.SetRange("Series Code", NoSeriesCode);
RaiseSetAdditionalNoSeriesLineFilters(NoSeriesLine2);
grobyns marked this conversation as resolved.
Show resolved Hide resolved
grobyns marked this conversation as resolved.
Show resolved Hide resolved
If NoSeriesLine2."Series Code" <> NoSeriesCode then
grobyns marked this conversation as resolved.
Show resolved Hide resolved
Error(CodeFieldChangedErr); // Extensions should never change the code field range, this is a bug that developers should know immediately.
grobyns marked this conversation as resolved.
Show resolved Hide resolved

NoSeriesLine.SetCurrentKey("Series Code", "Starting Date");
NoSeriesLine.CopyFilters(NoSeriesLine2);
end;

procedure CalculateOpen(NoSeriesLine: Record "No. Series Line"): Boolean
var
NoSeries: Codeunit "No. Series";
Expand Down Expand Up @@ -389,4 +404,9 @@ codeunit 305 "No. Series - Setup Impl."
if NumberSequence.Exists(Rec."Sequence Name") then
NumberSequence.Delete(Rec."Sequence Name");
end;

[IntegrationEvent(false, false)]
internal procedure RaiseSetAdditionalNoSeriesLineFilters(var NoSeriesLine: Record "No. Series Line");
PeterDurrer marked this conversation as resolved.
Show resolved Hide resolved
begin
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,13 @@ codeunit 310 "No. Series"
internal procedure OnAfterSetNoSeriesCurrentLineFilters(NoSeries: Record "No. Series"; var NoSeriesLine: Record "No. Series Line"; IsDrillDown: Boolean);
begin
end;

/// <summary>
/// Use this event to change the filters set on the No. Series Line record. These filters are used when searching the No. Series.
grobyns marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
/// <param name="NoSeriesLine">The No. Series Line to set filters on.</param>
PeterDurrer marked this conversation as resolved.
Show resolved Hide resolved
[IntegrationEvent(false, false)]
internal procedure OnGetNoSeriesLineOnBeforeFindLast(var NoSeriesLine: Record "No. Series Line");
grobyns marked this conversation as resolved.
Show resolved Hide resolved
begin
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ codeunit 304 "No. Series - Impl."
NoSeriesLine2.SetCurrentKey("Series Code", "Starting Date");
NoSeriesLine2.SetRange("Series Code", NoSeriesCode);
NoSeriesLine2.SetRange("Starting Date", 0D, UsageDate);
NoSeries.OnGetNoSeriesLineOnBeforeFindLast(NoSeriesLine2);
grobyns marked this conversation as resolved.
Show resolved Hide resolved
grobyns marked this conversation as resolved.
Show resolved Hide resolved
#if not CLEAN24
#pragma warning disable AL0432
NoSeriesManagement.RaiseObsoleteOnNoSeriesLineFilterOnBeforeFindLast(NoSeriesLine2);
Expand Down
Loading