Skip to content

Commit

Permalink
Remove update lock from batch (#581)
Browse files Browse the repository at this point in the history
With the update lock, we start a transaction, which means you cannot run
pages and similar when using the No. Series - Batch, which
NoSeriesManagement. Instead we now fail when calling SaveNoSeries simlar
to how NoSeriesManagement behaves (aligning behaviour).

Fixes
[AB#471519](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/471519)
  • Loading branch information
AndreasMoth authored Feb 14, 2024
1 parent c1e527c commit 2201668
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ codeunit 309 "No. Series - Batch Impl."

var
TempGlobalNoSeriesLine: Record "No. Series Line" temporary;
LockedNoSeriesLine: Record "No. Series Line";
SimulationMode: Boolean;
CannotSaveNonExistingNoSeriesErr: Label 'Cannot save No. Series Line that does not exist: %1, %2', Comment = '%1 = No. Series Code, %2 = Line No.';
CannotSaveWhileSimulatingNumbersErr: Label 'No. Series state cannot be saved while simulating numbers.';
Expand Down Expand Up @@ -77,7 +76,6 @@ codeunit 309 "No. Series - Batch Impl."
NextNo: Code[20];
begin
SyncGlobalLineWithProvidedLine(TempNoSeriesLine, UsageDate);
LockedNoSeriesLine.ReadIsolation(IsolationLevel::UpdLock);
NextNo := NoSeries.GetNextNo(TempGlobalNoSeriesLine, UsageDate, HideErrorsAndWarnings);
TempNoSeriesLine := TempGlobalNoSeriesLine;
exit(NextNo);
Expand Down Expand Up @@ -151,11 +149,13 @@ codeunit 309 "No. Series - Batch Impl."

[InherentPermissions(PermissionObjectType::TableData, Database::"No. Series Line", 'm')]
local procedure UpdateNoSeriesLine(var TempNoSeriesLine: Record "No. Series Line" temporary)
var
NoSeriesLine: Record "No. Series Line";
begin
LockedNoSeriesLine.Get(TempNoSeriesLine."Series Code", TempNoSeriesLine."Line No.");
LockedNoSeriesLine.TransferFields(TempNoSeriesLine);
LockedNoSeriesLine.Modify(true);
TempNoSeriesLine := LockedNoSeriesLine;
NoSeriesLine.Get(TempNoSeriesLine."Series Code", TempNoSeriesLine."Line No.");
NoSeriesLine.TransferFields(TempNoSeriesLine);
NoSeriesLine.Modify(true);
TempNoSeriesLine := NoSeriesLine;
TempNoSeriesLine.Modify();
end;

Expand Down

0 comments on commit 2201668

Please sign in to comment.