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

Obsolete IncrementNoText in favor of IncStr #3112

Merged
merged 6 commits into from
Mar 14, 2025
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 @@ -126,7 +126,7 @@ begin
if GenJnlBatch."No. Series" <> '' then begin
NoSeriesManagement.SetNoSeriesLineFilter(NoSeriesLine, GenJnlBatch."No. Series", "Posting Date");
if NoSeriesLine."Increment-by No." > 1 then
NoSeriesManagement.IncrementNoText(LastDocNumber, NoSeriesLine."Increment-by No.")
LastDocNumber := IncStr(LastDocNumber, NoSeriesLine."Increment-by No.")
else
LastDocNumber := IncStr(LastDocNumber);
end else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ codeunit 396 NoSeriesManagement
if NoSeriesLine."Increment-by No." <= 1 then
NoSeriesLine."Last No. Used" := IncStr(NoSeriesLine."Last No. Used")
else
IncrementNoText(NoSeriesLine."Last No. Used", NoSeriesLine."Increment-by No.");
NoSeriesLine."Last No. Used" := IncStr(NoSeriesLine."Last No. Used", NoSeriesLine."Increment-by No.");

// Ensure number is within the valid range
if (NoSeriesLine."Ending No." <> '') and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ codeunit 299 "No. Series - Setup"
exit(NoSeriesSetupImpl.CalculateOpen(NoSeriesLine))
end;

#if not CLEAN27
/// <summary>
/// Increments the given No. by the specified Increment.
/// </summary>
/// <param name="No">The number, as a code string to increment</param>
/// <param name="Increment">Indicates by how much to increment the No.</param>
/// <returns>The incremented No.</returns>
[Obsolete('Use IncStr(No, Increment) instead.', '27.0')]
procedure IncrementNoText(No: Code[20]; Increment: Integer): Code[20]
var
NoSeriesSetupImpl: Codeunit "No. Series - Setup Impl.";
begin
exit(NoSeriesSetupImpl.IncrementNoText(No, Increment));
end;
#endif

/// <summary>
/// Updates the different No. fields in the No. Series Line based on the pattern provided in the NewNo parameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ codeunit 305 "No. Series - Setup Impl."
exit(false);

if NoSeriesLine."Increment-by No." <> 1 then begin
NextNo := IncrementNoText(LastNoUsed, NoSeriesLine."Increment-by No.");
NextNo := IncStr(LastNoUsed, NoSeriesLine."Increment-by No.");
if NextNo > NoSeriesLine."Ending No." then
exit(false);
if StrLen(NextNo) > StrLen(NoSeriesLine."Ending No.") then
Expand Down Expand Up @@ -220,6 +220,7 @@ codeunit 305 "No. Series - Setup Impl."
NoSeries.Validate("Default Nos.", true);
end;

#if not CLEAN27
procedure IncrementNoText(No: Code[20]; Increment: Integer): Code[20]
var
BigIntNo: BigInteger;
Expand All @@ -235,6 +236,7 @@ codeunit 305 "No. Series - Setup Impl."
ReplaceNoText(No, NewNo, 0, StartPos, EndPos);
exit(No);
end;
#endif

procedure UpdateNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NewNo: Code[20]; NewFieldCaption: Text[100])
var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ codeunit 306 "No. Series - Stateless Impl." implements "No. Series - Single"

[InherentPermissions(PermissionObjectType::TableData, Database::"No. Series Line", 'm')]
local procedure GetNextNoInternal(var NoSeriesLine: Record "No. Series Line"; ModifySeries: Boolean; UsageDate: Date; HideErrorsAndWarnings: Boolean): Code[20]
var
NoSeriesSetup: Codeunit "No. Series - Setup";
begin
if NoSeriesLine."Last No. Used" = '' then begin
if HideErrorsAndWarnings and (NoSeriesLine."Starting No." = '') then
Expand All @@ -49,7 +47,7 @@ codeunit 306 "No. Series - Stateless Impl." implements "No. Series - Single"
if NoSeriesLine."Increment-by No." <= 1 then
NoSeriesLine."Last No. Used" := IncStr(NoSeriesLine."Last No. Used")
else
NoSeriesLine."Last No. Used" := NoSeriesSetup.IncrementNoText(NoSeriesLine."Last No. Used", NoSeriesLine."Increment-by No.");
NoSeriesLine."Last No. Used" := IncStr(NoSeriesLine."Last No. Used", NoSeriesLine."Increment-by No.");

if not EnsureLastNoUsedIsWithinValidRange(NoSeriesLine, HideErrorsAndWarnings) then
exit('');
Expand Down
Loading