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

remove NoSeriesMgt #535

Merged
merged 13 commits into from
Feb 6, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,20 @@ tableextension 309 NoSeriesLineObsolete extends "No. Series Line"
exit(NoSeries.PeekNextNo(Rec, WorkDate()));
end;

[Obsolete('This functionality has been removed and getting the number from a string is no longer part of No. Series.', '24.0')]
[Obsolete('This functionality has been made internal.', '24.0')]
grobyns marked this conversation as resolved.
Show resolved Hide resolved
procedure ExtractNoFromCode(NumberCode: Code[20]): BigInteger
var
NoSeriesMgt: Codeunit NoSeriesMgt;
NoSeriesSequenceImpl: Codeunit "No. Series - Sequence Impl.";
begin
exit(NoSeriesMgt.ExtractNoFromCode(NumberCode));
exit(NoSeriesSequenceImpl.ExtractNoFromCode(NumberCode));
end;

[Obsolete('This functionality has been removed.', '24.0')]
[Obsolete('This functionality has been made internal.', '24.0')]
procedure GetFormattedNo(Number: BigInteger): Code[20]
var
NoSeriesMgt: Codeunit NoSeriesMgt;
NoSeriesSequenceImpl: Codeunit "No. Series - Sequence Impl.";
begin
exit(NoSeriesMgt.GetFormattedNo(Rec, Number));
exit(NoSeriesSequenceImpl.GetFormattedNo(Rec, Number));
end;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
procedure SaveNoSeries()
var
NoSeries: Codeunit "No. Series";
NoSeriesMgt: Codeunit NoSeriesMgt;
NoSeriesSequenceImpl: Codeunit "No. Series - Sequence Impl.";
IsHandled: Boolean;
begin
IsHandled := false;
Expand All @@ -467,19 +467,60 @@
if LastNoSeriesLine."Series Code" <> '' then begin
if (LastNoSeriesLine.Implementation = "No. Series Implementation"::Sequence) then
if (LastNoSeriesLine."Last No. Used" <> '') and (LastNoSeriesLine."Last No. Used" > NoSeries.GetLastNoUsed(LastNoSeriesLine)) then
NoSeriesMgt.RestartSequence(LastNoSeriesLine, NoSeriesMgt.ExtractNoFromCode(LastNoSeriesLine."Last No. Used"));
RestartSequence(LastNoSeriesLine, NoSeriesSequenceImpl.ExtractNoFromCode(LastNoSeriesLine."Last No. Used"));
if not (LastNoSeriesLine.Implementation = "No. Series Implementation"::Sequence) or UpdateLastUsedDate then
ModifyNoSeriesLine(LastNoSeriesLine);
end;
OnAfterSaveNoSeries(LastNoSeriesLine);
end;

internal procedure RestartSequence(var NoSeriesLine: Record "No. Series Line"; NewStartingNo: BigInteger)
begin
NoSeriesLine.TestField(Implementation, NoSeriesLine.Implementation::Sequence);
NoSeriesLine.TestField("Sequence Name");
NoSeriesLine."Starting Sequence No." := NewStartingNo;
if NoSeriesLine."Last No. Used" = '' then
NumberSequence.Restart(NoSeriesLine."Sequence Name", NoSeriesLine."Starting Sequence No." - NoSeriesLine."Increment-by No.")
else begin
NumberSequence.Restart(NoSeriesLine."Sequence Name", NoSeriesLine."Starting Sequence No.");
if NumberSequence.Next(NoSeriesLine."Sequence Name") = 0 then; // Simulate that a number was used
end;
end;
#endif
procedure ClearNoSeriesLine()
begin
Clear(LastNoSeriesLine);
end;

#if not CLEAN24
internal procedure SetAllowGaps(var NoSeries: Record "No. Series"; AllowGaps: Boolean)
var
NoSeriesLine: Record "No. Series Line";
StartDate: Date;
begin
FindNoSeriesLineToShow(NoSeries, NoSeriesLine);
StartDate := NoSeriesLine."Starting Date";
NoSeriesLine.SetRange("Allow Gaps in Nos.", not AllowGaps);
NoSeriesLine.SetFilter("Starting Date", '>=%1', StartDate);
NoSeriesLine.LockTable();
if NoSeriesLine.FindSet() then
repeat
NoSeriesLine.Validate("Allow Gaps in Nos.", AllowGaps);
NoSeriesLine.Modify();
until NoSeriesLine.Next() = 0;
end;

internal procedure FindNoSeriesLineToShow(var NoSeries: Record "No. Series"; var NoSeriesLine: Record "No. Series Line")
begin
SetNoSeriesLineFilter(NoSeriesLine, NoSeries.Code, 0D);

if NoSeriesLine.FindLast() then
exit;

NoSeriesLine.Reset();
NoSeriesLine.SetRange("Series Code", NoSeries.Code);
end;

[Obsolete('Please use the procedure GetNoSeriesLine on the "No. Series" and "No. Series - Batch" codeunits instead', '24.0')]
procedure SetNoSeriesLineFilter(var NoSeriesLine: Record "No. Series Line"; NoSeriesCode: Code[20]; StartDate: Date)
begin
Expand All @@ -496,12 +537,12 @@
NoSeriesLine.SetRange(Open, true);
end;
end;
#endif

internal procedure RaiseObsoleteOnNoSeriesLineFilterOnBeforeFindLast(var NoSeriesLine: Record "No. Series Line")
begin
OnNoSeriesLineFilterOnBeforeFindLast(NoSeriesLine);
end;
#endif

procedure IncrementNoText(var No: Code[20]; IncrementByNo: Decimal)
var
Expand All @@ -511,13 +552,15 @@
EndPos: Integer;
NewNo: Code[20];
begin
GetIntegerPos(No, StartPos, EndPos);

Check failure on line 555 in src/Business Foundation/App/NoSeries/src/Legacy/NoSeriesManagement.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build Business Foundation (Clean) / Business Foundation (Clean)

AL0118 The name 'GetIntegerPos' does not exist in the current context.
Evaluate(BigIntNo, CopyStr(No, StartPos, EndPos - StartPos + 1));
BigIntIncByNo := IncrementByNo;
NewNo := CopyStr(Format(BigIntNo + BigIntIncByNo, 0, 1), 1, MaxStrLen(NewNo));
ReplaceNoText(No, NewNo, 0, StartPos, EndPos);

Check failure on line 559 in src/Business Foundation/App/NoSeries/src/Legacy/NoSeriesManagement.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build Business Foundation (Clean) / Business Foundation (Clean)

AL0118 The name 'ReplaceNoText' does not exist in the current context.
end;

#if not CLEAN24
[Obsolete('The method was moved to No. Series Setup Impl. and is now internal.', '24.0')]
grobyns marked this conversation as resolved.
Show resolved Hide resolved
procedure UpdateNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NewNo: Code[20]; NewFieldName: Text[100])
var
NoSeriesLine2: Record "No. Series Line";
Expand Down Expand Up @@ -635,21 +678,16 @@
end;
end;

#if not CLEAN24
[Obsolete('The No. Series Line Sales table is obsolete. Please use the No. Series Line table instead.', '24.0')]
[Scope('OnPrem')]
procedure SetNoSeriesLineSalesFilter(var NoSeriesLineSales: Record "No. Series Line Sales"; NoSeriesCode: Code[20]; StartDate: Date)
var
NoSeriesMgt: Codeunit NoSeriesMgt;
begin
OnObsoleteSetNoSeriesLineSalesFilter(NoSeriesLineSales, NoSeriesCode, StartDate);
end;

[Obsolete('The No. Series Line Purchase table is obsolete. Please use the No. Series Line table instead.', '24.0')]
[Scope('OnPrem')]
procedure SetNoSeriesLinePurchaseFilter(var NoSeriesLinePurchase: Record "No. Series Line Purchase"; NoSeriesCode: Code[20]; StartDate: Date)
var
NoSeriesMgt: Codeunit NoSeriesMgt;
begin
OnObsoleteSetNoSeriesLinePurchaseFilter(NoSeriesLinePurchase, NoSeriesCode, StartDate);
end;
Expand Down Expand Up @@ -931,11 +969,19 @@
begin
end;

[IntegrationEvent(false, false)]
internal procedure OnBeforeUpdateNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NewNo: Code[20]; NewFieldName: Text[100]; var IsHandled: Boolean)
#if not CLEAN24
[Obsolete('This is a temporary method for compatibility only. Please use the "No. Series" codeunit instead', '24.0')]
internal procedure RaiseObsoleteOnBeforeUpdateNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NewNo: Code[20]; NewFieldName: Text[100]; var IsHandled: Boolean)
grobyns marked this conversation as resolved.
Show resolved Hide resolved
begin
OnBeforeUpdateNoSeriesLine(NoSeriesLine, NewNo, NewFieldName, IsHandled);
end;

[Obsolete('This event is obsolete. Please use the extensibility options provided by the No. Series module.', '24.0')]
grobyns marked this conversation as resolved.
Show resolved Hide resolved
[IntegrationEvent(false, false)]
local procedure OnBeforeUpdateNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NewNo: Code[20]; NewFieldName: Text[100]; var IsHandled: Boolean)
begin
end;
#endif
procedure ClearStateAndGetNextNo(NoSeriesCode: Code[20]): Code[20]
begin
Clear(LastNoSeriesLine);
Expand Down
Loading
Loading