Skip to content

Commit

Permalink
Update code with latest changes (February 8th) (#25875)
Browse files Browse the repository at this point in the history
<!-- Thank you for submitting a Pull Request. If you're new to
contributing to AlAppExtensions please read our pull request guideline
below
* https://github.com/microsoft/ALAppExtensions/blob/main/CONTRIBUTING.md
-->
#### Summary <!-- Provide a general summary of your changes -->
Update code with latest changes (February 8th)

#### Work Item(s) <!-- Add the issue number here after the #. The issue
needs to be open and approved. Submitting PRs with no linked issues or
unapproved issues is highly discouraged. -->
Fixes
[AB#420000](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/420000)

---------

Co-authored-by: aholstrup1 <[email protected]@users.noreply.github.com>
  • Loading branch information
aholstrup1 and aholstrup1 authored Feb 9, 2024
1 parent 2b98715 commit 3ec0ce7
Show file tree
Hide file tree
Showing 271 changed files with 14,744 additions and 1,361 deletions.
122 changes: 61 additions & 61 deletions .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
{
"type": "PTE",
"templateUrl": "https://github.com/microsoft/AL-Go-PTE@preview",
"bcContainerHelperVersion": "preview",
"runs-on": "windows-latest",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider.azureedge.net/sandbox/24.0.15733.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "24.0",
"cleanModePreprocessorSymbols": [
"CLEAN17",
"CLEAN18",
"CLEAN19",
"CLEAN20",
"CLEAN21",
"CLEAN22",
"CLEAN23",
"CLEAN24"
],
"unusedALGoSystemFiles": [
"AddExistingAppOrTestApp.yaml",
"CreateApp.yaml",
"CreateOnlineDevelopmentEnvironment.yaml",
"CreatePerformanceTestApp.yaml",
"CreateRelease.yaml",
"CreateTestApp.yaml",
"Current.yaml",
"IncrementVersionNumber.yaml",
"NextMajor.yaml",
"NextMinor.yaml",
"PublishToEnvironment.yaml",
"Test Current.settings.json"
],
"excludeEnvironments": [
"Official-Build"
],
"buildModes": [
"Translated"
],
"CICDPushBranches": [
"main"
],
"CICDPullRequestBranches": [
"main"
],
"enableCodeCop": true,
"enableAppSourceCop": true,
"enablePerTenantExtensionCop": true,
"enableUICop": true,
"rulesetFile": "..\\..\\..\\Apps\\rulesets\\app.ruleset.json",
"skipUpgrade": true,
"fullBuildPatterns": [
"Build/*",
"src/rulesets/*",
".github/workflows/PullRequestHandler.yaml",
".github/workflows/_BuildALGoProject.yaml"
],
"UpdateALGoSystemFilesEnvironment": "Official-Build",
"PullRequestTrigger": "pull_request",
"templateSha": "0476547896ebcd3ba5455b3e0e59b48c0d4a26ca"
"type": "PTE",
"templateUrl": "https://github.com/microsoft/AL-Go-PTE@preview",
"bcContainerHelperVersion": "preview",
"runs-on": "windows-latest",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider.azureedge.net/sandbox/24.0.16034.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "24.0",
"cleanModePreprocessorSymbols": [
"CLEAN17",
"CLEAN18",
"CLEAN19",
"CLEAN20",
"CLEAN21",
"CLEAN22",
"CLEAN23",
"CLEAN24"
],
"unusedALGoSystemFiles": [
"AddExistingAppOrTestApp.yaml",
"CreateApp.yaml",
"CreateOnlineDevelopmentEnvironment.yaml",
"CreatePerformanceTestApp.yaml",
"CreateRelease.yaml",
"CreateTestApp.yaml",
"Current.yaml",
"IncrementVersionNumber.yaml",
"NextMajor.yaml",
"NextMinor.yaml",
"PublishToEnvironment.yaml",
"Test Current.settings.json"
],
"excludeEnvironments": [
"Official-Build"
],
"buildModes": [
"Translated"
],
"CICDPushBranches": [
"main"
],
"CICDPullRequestBranches": [
"main"
],
"enableCodeCop": true,
"enableAppSourceCop": true,
"enablePerTenantExtensionCop": true,
"enableUICop": true,
"rulesetFile": "..\\..\\..\\Apps\\rulesets\\app.ruleset.json",
"skipUpgrade": true,
"fullBuildPatterns": [
"Build/*",
"src/rulesets/*",
".github/workflows/PullRequestHandler.yaml",
".github/workflows/_BuildALGoProject.yaml"
],
"UpdateALGoSystemFilesEnvironment": "Official-Build",
"PullRequestTrigger": "pull_request",
"templateSha": "0476547896ebcd3ba5455b3e0e59b48c0d4a26ca"
}
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ codeunit 11518 "Swiss QR-Bill Mgt."
exit(Language.GetLanguageCode(GetLanguageIdENU()));
end;

internal procedure DeleteTenantMedia(MediaId: Guid)
procedure DeleteTenantMedia(MediaId: Guid)
var
TenantMedia: Record "Tenant Media";
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ codeunit 11502 "Swiss QR-Bill Purchases"
GenJournalTemplate: Record "Gen. Journal Template";
GenJournalBatch: Record "Gen. Journal Batch";
NewGenJournalLine: Record "Gen. Journal Line";
NoSeriesBatch: Codeunit "No. Series - Batch";
LastLineNo: Integer;
Finish: Boolean;
MessageResult: Text;
Expand All @@ -442,7 +443,7 @@ codeunit 11502 "Swiss QR-Bill Purchases"
LastLineNo += 10000;
NewGenJournalLine."Line No." := LastLineNo;
NewGenJournalLine.Insert();
NewGenJournalLine.IncrementDocumentNo(GenJournalBatch, NewDocumentNo);
NewDocumentNo := NoSeriesBatch.SimulateGetNextNo(GenJournalBatch."No. Series", NewGenJournalLine."Posting Date", NewDocumentNo);
Commit();
finish := not Confirm(MessageResult)
end else
Expand All @@ -454,7 +455,7 @@ codeunit 11502 "Swiss QR-Bill Purchases"

local procedure PreparePurchaseJournalLine(var GenJournalLine: Record "Gen. Journal Line"; var GenJournalTemplate: Record "Gen. Journal Template"; var GenJournalBatch: Record "Gen. Journal Batch"; var LastLineNo: Integer; var NewDocumentNo: Code[20])
var
NoSeriesManagement: Codeunit NoSeriesManagement;
NoSeriesBatch: Codeunit "No. Series - Batch";
begin
with GenJournalLine do begin
GenJournalTemplate.Get("Journal Template Name");
Expand All @@ -466,9 +467,9 @@ codeunit 11502 "Swiss QR-Bill Purchases"
NewDocumentNo := "Document No.";
end;
if NewDocumentNo = '' then
NewDocumentNo := NoSeriesManagement.TryGetNextNo(GenJournalBatch."No. Series", WorkDate())
NewDocumentNo := NoSeriesBatch.PeekNextNo(GenJournalBatch."No. Series", WorkDate())
else
IncrementDocumentNo(GenJournalBatch, NewDocumentNo);
NewDocumentNo := NoSeriesBatch.SimulateGetNextNo(GenJournalBatch."No. Series", GenJournalLine."Posting Date", NewDocumentNo)
end;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using Microsoft.Purchases.Payables;

codeunit 31141 "Document Type Handler CZZ"
{
Access = Internal;
EventSubscriberInstance = Manual;

[EventSubscriber(ObjectType::Table, Database::"G/L Entry", 'OnAfterCopyGLEntryFromGenJnlLine', '', false, false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ codeunit 31019 "PurchAdvLetterManagement CZZ"

PurchAdvLetterEntryCZZ2.CalcSums(Amount);
TempAdvancePostingBufferCZZ.CalcSums(Amount);
if Abs(PurchAdvLetterEntryCZZ.Amount - PurchAdvLetterEntryCZZ2.Amount) < Abs(TempAdvancePostingBufferCZZ.Amount) then
if (PurchAdvLetterEntryCZZ.Amount - PurchAdvLetterEntryCZZ2.Amount) < TempAdvancePostingBufferCZZ.Amount then
Error(ExceededAmountErr);

GetCurrency(PurchAdvLetterEntryCZZ."Currency Code");
Expand Down Expand Up @@ -586,19 +586,14 @@ codeunit 31019 "PurchAdvLetterManagement CZZ"

local procedure BufferAdvanceLines(PurchAdvLetterHeaderCZZ: Record "Purch. Adv. Letter Header CZZ"; var AdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ")
var
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
PurchAdvLetterLineCZZ: Record "Purch. Adv. Letter Line CZZ";
TempAdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ" temporary;
begin
AdvancePostingBufferCZZ.Reset();
AdvancePostingBufferCZZ.DeleteAll();

AdvanceLetterTemplateCZZ.Get(PurchAdvLetterHeaderCZZ."Advance Letter Code");

PurchAdvLetterLineCZZ.SetRange("Document No.", PurchAdvLetterHeaderCZZ."No.");
PurchAdvLetterLineCZZ.SetFilter(Amount, '<>0');
if not AdvanceLetterTemplateCZZ."Post VAT Doc. for Rev. Charge" then
PurchAdvLetterLineCZZ.SetFilter("VAT Calculation Type", '<>%1', PurchAdvLetterLineCZZ."VAT Calculation Type"::"Reverse Charge VAT");
if PurchAdvLetterLineCZZ.FindSet() then
repeat
TempAdvancePostingBufferCZZ.PrepareForPurchAdvLetterLine(PurchAdvLetterLineCZZ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"

SalesAdvLetterEntryCZZ2.CalcSums(Amount);
TempAdvancePostingBufferCZZ.CalcSums(Amount);
if Abs(SalesAdvLetterEntryCZZ.Amount - SalesAdvLetterEntryCZZ2.Amount) < Abs(TempAdvancePostingBufferCZZ.Amount) then
if (SalesAdvLetterEntryCZZ.Amount - SalesAdvLetterEntryCZZ2.Amount) < TempAdvancePostingBufferCZZ.Amount then
Error(ExceededAmountErr);

GetCurrency(SalesAdvLetterEntryCZZ."Currency Code");
Expand Down Expand Up @@ -624,19 +624,14 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"

local procedure BufferAdvanceLines(SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; var AdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ")
var
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
SalesAdvLetterLineCZZ: Record "Sales Adv. Letter Line CZZ";
TempAdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ" temporary;
begin
AdvancePostingBufferCZZ.Reset();
AdvancePostingBufferCZZ.DeleteAll();

AdvanceLetterTemplateCZZ.Get(SalesAdvLetterHeaderCZZ."Advance Letter Code");

SalesAdvLetterLineCZZ.SetRange("Document No.", SalesAdvLetterHeaderCZZ."No.");
SalesAdvLetterLineCZZ.SetFilter(Amount, '<>0');
if not AdvanceLetterTemplateCZZ."Post VAT Doc. for Rev. Charge" then
SalesAdvLetterLineCZZ.SetFilter("VAT Calculation Type", '<>%1', SalesAdvLetterLineCZZ."VAT Calculation Type"::"Reverse Charge VAT");
if SalesAdvLetterLineCZZ.FindSet() then
repeat
TempAdvancePostingBufferCZZ.PrepareForSalesAdvLetterLine(SalesAdvLetterLineCZZ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ codeunit 31088 "Upgrade Application CZZ"
InstallApplicationCZZ.CopyData();
UpgradeCustomerNoInSalesAdvLetterEntries();
UpgradeAdvanceLetterApplicationAmountLCY();
UpgradePostVATDocForReverseCharge();
end;

local procedure UpgradeAdvancePaymentsReportReportSelections();
Expand Down Expand Up @@ -122,21 +121,6 @@ codeunit 31088 "Upgrade Application CZZ"
UpgradeTag.SetUpgradeTag(UpgradeTagDefinitionsCZZ.GetAdvanceLetterApplicationAmountLCYUpgradeTag());
end;

local procedure UpgradePostVATDocForReverseCharge()
var
AdvanceLetterTemplate: Record "Advance Letter Template CZZ";
AdvLetterTemplateDataTransfer: DataTransfer;
begin
if UpgradeTag.HasUpgradeTag(UpgradeTagDefinitionsCZZ.GetPostVATDocForReverseChargeUpgradeTag()) then
exit;

AdvLetterTemplateDataTransfer.SetTables(Database::"Advance Letter Template CZZ", Database::"Advance Letter Template CZZ");
AdvLetterTemplateDataTransfer.AddConstantValue(true, AdvanceLetterTemplate.FieldNo("Post VAT Doc. for Rev. Charge"));
AdvLetterTemplateDataTransfer.CopyFields();

UpgradeTag.SetUpgradeTag(UpgradeTagDefinitionsCZZ.GetPostVATDocForReverseChargeUpgradeTag());
end;

local procedure GetCurrencyFactor(AdvanceLetterType: Enum "Advance Letter Type CZZ"; AdvanceLetterNo: Code[20]): Decimal
var
PurchAdvLetterHeader: Record "Purch. Adv. Letter Header CZZ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ codeunit 31089 "Upgrade Tag Definitions CZZ"
PerCompanyUpgradeTags.Add(GetDataVersion210PerCompanyUpgradeTag());
PerCompanyUpgradeTags.Add(GetSalesAdvLetterEntryCustomerNoUpgradeTag());
PerCompanyUpgradeTags.Add(GetAdvanceLetterApplicationAmountLCYUpgradeTag());
PerCompanyUpgradeTags.Add(GetPostVATDocForReverseChargeUpgradeTag());
end;

procedure GetDataVersion190PerDatabaseUpgradeTag(): Code[250]
Expand Down Expand Up @@ -66,9 +65,4 @@ codeunit 31089 "Upgrade Tag Definitions CZZ"
begin
exit('CZZ-478403-AdvanceLetterApplicationAmountLCYUpgradeTag-20230717');
end;

procedure GetPostVATDocForReverseChargeUpgradeTag(): Code[250]
begin
exit('CZZ-494279-PostVATDocForReverseChargeUpgradeTag-20240111');
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ page 31179 "Advance Letter Templates CZZ"
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies automatic post VAT document.';
}
field("Post VAT Doc. for Rev. Charge"; Rec."Post VAT Doc. for Rev. Charge")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies whether the VAT document will be posting for reverse charge.';
}
#if not CLEAN23
#pragma warning disable AL0432,AS0074
field("Document Report ID"; '')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ page 31185 "VAT Document CZZ"
trigger OnValidate()
begin
if DocumentNo <> InitDocumentNo then
NoSeriesManagement.TestManual(NoSeriesCode);
NoSeries.TestManual(NoSeriesCode);
end;

trigger OnAssistEdit()
var
NoSeriesManagement2: Codeunit NoSeriesManagement;
begin
if NoSeriesManagement2.SelectSeries(InitNoSeriesCode, NoSeriesCode, NoSeriesCode) then begin
Clear(NoSeriesManagement);

DocumentNo := NoSeriesManagement.GetNextNo(NoSeriesCode, PostingDate, false);
DocumentNo := NoSeriesBatch.GetNextNo(NoSeriesCode, PostingDate);
InitDocumentNo := DocumentNo;
end;
end;
Expand Down Expand Up @@ -139,7 +137,8 @@ page 31185 "VAT Document CZZ"
}

var
NoSeriesManagement: Codeunit NoSeriesManagement;
NoSeriesBatch: Codeunit "No. Series - Batch";
NoSeries: Codeunit "No. Series";
DocumentNo: Code[20];
InitDocumentNo: Code[20];
ExternalDocumentNo: Code[35];
Expand Down Expand Up @@ -190,7 +189,7 @@ page 31185 "VAT Document CZZ"
DocumentNo := NewDocumentNo;
DocumentNoEditable := false;
end else begin
DocumentNo := NoSeriesManagement.GetNextNo(NoSeriesCode, PostingDate, false);
DocumentNo := NoSeriesBatch.GetNextNo(NoSeriesCode, PostingDate);
DocumentNoEditable := true;
end;
InitDocumentNo := DocumentNo;
Expand Down Expand Up @@ -254,7 +253,7 @@ page 31185 "VAT Document CZZ"

procedure SaveNoSeries()
begin
NoSeriesManagement.SaveNoSeries();
NoSeriesBatch.SaveState();
end;

local procedure UpdateCurrencyFactor(NewCurrencyFactor: Decimal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ table 31003 "Advance Letter Template CZZ"
Caption = 'Automatic Post VAT Document';
DataClassification = CustomerContent;
}
field(26; "Post VAT Doc. for Rev. Charge"; Boolean)
{
Caption = 'Post VAT Document for Reverse Charge';
DataClassification = CustomerContent;
InitValue = true;
}
}
keys
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ table 31008 "Purch. Adv. Letter Header CZZ"
begin
if "No." <> xRec."No." then begin
GetSetup();
NoSeriesManagement.TestManual(AdvanceLetterTemplateCZZ."Advance Letter Document Nos.");
NoSeries.TestManual(AdvanceLetterTemplateCZZ."Advance Letter Document Nos.");
"No. Series" := '';
end;
end;
Expand Down Expand Up @@ -854,6 +854,7 @@ table 31008 "Purch. Adv. Letter Header CZZ"
SalespersonPurchaser: Record "Salesperson/Purchaser";
ResponsibilityCenter: Record "Responsibility Center";
NoSeriesManagement: Codeunit NoSeriesManagement;
NoSeries: Codeunit "No. Series";
DimensionManagement: Codeunit DimensionManagement;
UserSetupManagement: Codeunit "User Setup Management";
#if not CLEAN22
Expand Down Expand Up @@ -931,9 +932,20 @@ table 31008 "Purch. Adv. Letter Header CZZ"
if "No." = '' then begin
GetSetup();
AdvanceLetterTemplateCZZ.TestField("Advance Letter Document Nos.");
NoSeriesManagement.InitSeries(AdvanceLetterTemplateCZZ."Advance Letter Document Nos.", xRec."No. Series", "Posting Date", "No.", "No. Series")
#if not CLEAN24
IsHandled := false;
NoSeriesManagement.RaiseObsoleteOnBeforeInitSeries(AdvanceLetterTemplateCZZ."Advance Letter Document Nos.", xRec."No. Series", "Posting Date", "No.", "No. Series", IsHandled);
if not IsHandled then begin
#endif
"No. Series" := AdvanceLetterTemplateCZZ."Advance Letter Document Nos.";
if NoSeries.AreRelated("No. Series", xRec."No. Series") then
"No. Series" := xRec."No. Series";
"No." := NoSeries.GetNextNo("No. Series", "Posting Date");
#if not CLEAN24
NoSeriesManagement.RaiseObsoleteOnAfterInitSeries("No. Series", AdvanceLetterTemplateCZZ."Advance Letter Document Nos.", "Posting Date", "No.");
end;
#endif
end;

OnInitInsertOnBeforeInitRecord(Rec, xRec);
InitRecord();
end;
Expand Down
Loading

0 comments on commit 3ec0ce7

Please sign in to comment.