Skip to content

Commit

Permalink
Syncing with version 26.0.25961.0 (#27550)
Browse files Browse the repository at this point in the history
  • Loading branch information
mazhelez authored Oct 29, 2024
1 parent 2d2552a commit 7ca090c
Show file tree
Hide file tree
Showing 132 changed files with 2,038 additions and 7,280 deletions.
2 changes: 1 addition & 1 deletion .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"runs-on": "windows-latest",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/26.0.25774.0/base",
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/26.0.25961.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "26.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ codeunit 10538 "MTD OAuth 2.0 Mgt"
CannotGetScopeFromKeyVaultErr: Label 'Cannot get Scope from Azure Key Vault using key %1', Locked = true;
CannotGetEndpointTextFromKeyVaultErr: Label 'Cannot get Endpoint from Azure Key Vault using key %1 ', Locked = true;
GetPublicIPAddressRequestFailedErr: Label 'Getting server public IP address from Azure Function failed.', Locked = true;
EmptyPublicIPAddressErr: Label 'Azure Function returned empty server public IP address.', Locked = true;
NonEmptyPublicIPAddressTxt: Label 'Non-empty server public IP address was returned by Azure Function', Locked = true;
EmptyPublicIPAddressAzFuncErr: Label 'Azure Function returned empty server public IP address.', Locked = true;
NonEmptyPublicIPAddressAzFuncTxt: Label 'Non-empty server public IP address was returned by Azure Function', Locked = true;
EmptyPublicIPAddressErr: Label 'Tenant settings returned empty server public IP address.', Locked = true;
NonEmptyPublicIPAddressTxt: Label 'Non-empty server public IP address was returned by tenant settings', Locked = true;
IPAddressNotMatchPatternErr: Label 'IP address from tenant settings does not match validation pattern %1. ', Locked = true;
IPv4LoopbackIPAddressTxt: Label '127.0.0.1', Locked = true;
IPv6LoopbackIPAddressTxt: Label '::1', Locked = true;

Expand Down Expand Up @@ -507,9 +510,9 @@ codeunit 10538 "MTD OAuth 2.0 Mgt"
end;
AzureFunctionsResponse.GetResultAsText(ServerIPAddress);
if ServerIPAddress = '' then
FeatureTelemetry.LogError('0000NRP', HMRCFraudPreventHeadersTok, '', EmptyPublicIPAddressErr)
FeatureTelemetry.LogError('0000NRP', HMRCFraudPreventHeadersTok, '', EmptyPublicIPAddressAzFuncErr)
else
FeatureTelemetry.LogUsage('0000NRW', HMRCFraudPreventHeadersTok, NonEmptyPublicIPAddressTxt);
FeatureTelemetry.LogUsage('0000NRW', HMRCFraudPreventHeadersTok, NonEmptyPublicIPAddressAzFuncTxt);
end;

[NonDebuggable]
Expand Down Expand Up @@ -551,6 +554,34 @@ codeunit 10538 "MTD OAuth 2.0 Mgt"
end;
end;

[TryFunction]
internal procedure GetServerPublicIPFromTenantSettings(var ServerIPAddress: Text)
var
TenantSettings: DotNet NavTenantSettingsHelper;
RegEx: DotNet Regex;
IPAddressRegExPattern: Text;
begin
if not EnvironmentInformation.IsSaaS() then
exit;

ServerIPAddress := TenantSettings.GetPublicIpAddress();

if ServerIPAddress = '' then begin
FeatureTelemetry.LogError('0000O1D', HMRCFraudPreventHeadersTok, '', EmptyPublicIPAddressErr);
exit;
end;

IPAddressRegExPattern := '[0-9]{1,3}(\.[0-9]{1,3}){3}|([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4})'; // IPv4 or IPv6
RegEx := RegEx.Regex(IPAddressRegExPattern);
if not RegEx.IsMatch(ServerIPAddress) then begin
FeatureTelemetry.LogError('0000O1E', HMRCFraudPreventHeadersTok, '', StrSubstNo(IPAddressNotMatchPatternErr, IPAddressRegExPattern));
ServerIPAddress := '';
exit;
end;

FeatureTelemetry.LogUsage('0000O1F', HMRCFraudPreventHeadersTok, NonEmptyPublicIPAddressTxt);
end;

local procedure CheckJsonTokenValidity(var JsonObject: JsonObject; TokenKey: Text; ValidationRegExPattern: Text) ErrorText: Text
var
JsonToken: JsonToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ codeunit 10541 "MTD Fraud Prevention Mgt."
ClientWindowTxt: Label 'width=%1&height=%2', Locked = true;
HMRCFraudPreventHeadersTok: label 'HMRC Fraud Prevention Headers', Locked = true;
NoFPHeadersFromJSErr: Label 'No FP headers were returned from JS.', Locked = true;
GetPublicIPAddressRequestFailedErr: Label 'Getting server public IP address from public service failed.', Locked = true;

internal procedure AddFraudPreventionHeaders(var RequestJSON: Text; ConfirmHeaders: Boolean)
var
Expand Down Expand Up @@ -89,7 +88,7 @@ codeunit 10541 "MTD Fraud Prevention Mgt."
Commit();
MTDWebClientFPHeaders.RunModal();

if GetVendorIP(vendorIP, VATReportSetup."MTD FP Public IP Service URL") then;
if GetVendorIP(vendorIP) then;
MTDSessionFraudPrevHdr.SafeInsert('Gov-Vendor-Public-IP', vendorIP);

if MTDSessionFraudPrevHdr.Get('Gov-Client-Public-IP') then
Expand Down Expand Up @@ -221,48 +220,21 @@ codeunit 10541 "MTD Fraud Prevention Mgt."
end;

[TryFunction]
internal procedure GetVendorIP(var Result: Text; url: Text)
var
Matches: Record Matches;
Regex: Codeunit Regex;
HttpClient: HttpClient;
HttpResponseMessage: HttpResponseMessage;
CustomDimensions: Dictionary of [Text, Text];
Content: Text;
RegExString: Text;
internal procedure GetVendorIP(var Result: Text)
begin
Result := '';
if MTDOAuth20Mgt.GetServerPublicIPFromAzureFunction(Result) then
if MTDOAuth20Mgt.GetServerPublicIPFromTenantSettings(Result) then
if Result <> '' then
exit;

HttpClient.Get(url, HttpResponseMessage);
if not HttpResponseMessage.IsSuccessStatusCode() then begin
CustomDimensions.Add('url', url);
CustomDimensions.Add('HttpStatusCode', Format(HttpResponseMessage.HttpStatusCode()));
CustomDimensions.Add('ReasonPhrase', HttpResponseMessage.ReasonPhrase);
CustomDimensions.Add('IsBlockedByEnvironment', Format(HttpResponseMessage.IsBlockedByEnvironment()));
FeatureTelemetry.LogError('0000NRN', HMRCFraudPreventHeadersTok, '', GetPublicIPAddressRequestFailedErr, '', CustomDimensions);
end;
HttpResponseMessage.Content().ReadAs(Content);
RegExString := '([0-9]{1,3}(\.[0-9]{1,3}){3})|(([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}))';
Regex.Match(Content, RegExString, 0, Matches);
if Matches.FindFirst() then
Result := Matches.ReadValue();
if MTDOAuth20Mgt.GetServerPublicIPFromAzureFunction(Result) then;
end;

internal procedure TestPublicIPServiceURL(url: Text)
var
MTDSessionFraudPrevHdr: Record "MTD Session Fraud Prev. Hdr";
MTDWebClientFPHeaders: Page "MTD Web Client FP Headers";
Result: Text;
begin
if not GetVendorIP(Result, url) then
Error(IPAddressErr);

if Result = '' then
Error(IPAddressErr);

MTDSessionFraudPrevHdr.DeleteAll();
MTDWebClientFPHeaders.SetPublicIPServiceURL(url);
Commit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ codeunit 18467 "Subcontracting Post Batch"
Item: Record Item;
ItemTrackingCode: Record "Item Tracking Code";
ItemTrackingSetup: Record "Item Tracking Setup";
TempTrackingSpecification: Record "Tracking Specification" temporary;
ItemTrackingManagement: Codeunit "Item Tracking Management";
ItemJnlPostBatch: Codeunit "Item Jnl.-Post Batch";

Inbound: Boolean;
SNRequired: Boolean;
Expand Down Expand Up @@ -193,7 +195,12 @@ codeunit 18467 "Subcontracting Post Batch"
if Item."Item Tracking Code" <> '' then
SubcontractingPost.TransferTrackingToItemJnlLine(SubOrderCompList, ItemJnlLine, SubOrderCompList."Quantity To Send", 0);

ItemJnlPostLine.RunWithCheck(ItemJnlLine);
if ItemJnlLine."Value Entry Type" <> ItemJnlLine."Value Entry Type"::Revaluation then begin
if not ItemJnlPostLine.RunWithCheck(ItemJnlLine) then
ItemJnlPostLine.CheckItemTracking();
ItemJnlPostLine.CollectTrackingSpecification(TempTrackingSpecification);
ItemJnlPostBatch.PostWhseJnlLine(ItemJnlLine, ItemJnlLine.Quantity, ItemJnlLine."Quantity (Base)", TempTrackingSpecification);
end;
end;

procedure PostPurchOrder(MultiSubOrderDet: Record "Multiple Subcon. Order Details")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ page 10678 "SAF-T VAT Posting Setup"
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the VAT code to be used with this VAT posting setup for sales reporting.';
ShowMandatory = SalesStandardTaxCodeMandatory;
Visible = false;
}
field("Purch. VAT Reporting Code"; Rec."Purch. VAT Reporting Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the VAT code to be used with this VAT posting setup for purchase reporting.';
ShowMandatory = PurchStandardTaxCodeMandatory;
Visible = false;
}
field("Sales SAF-T Tax Code"; "Sales SAF-T Tax Code")
{
Expand Down
3 changes: 3 additions & 0 deletions Apps/NO/NorwegianSAFT/test/src/SAFTTestHelper.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ codeunit 148099 "SAF-T Test Helper"
VATReportingCode: Record "VAT Reporting Code";
begin
VATPostingSetup.FindSet();
VATPostingSetup.Validate("Sale VAT Reporting Code", '');
VATPostingSetup.Validate("Purch. VAT Reporting Code", '');
VATPostingSetup.Modify(true);
VATPostingSetup.Next(); // do not specify any value for Standard Tax Code in order to verify that NA value will be exported in the XML file
VATReportingCode.FindSet();
repeat
Expand Down
3 changes: 3 additions & 0 deletions Apps/NO/NorwegianSAFT/test/src/SAFTWizardTests.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ codeunit 148101 "SAF-T Wizard Tests"
// [SCENARIO 309923] Stan can open VAT Posting Setup mapping page from the wizard and see the number of VAT combinations mapped

Initialize();
VATPostingSetup.ModifyAll("Sale VAT Reporting Code", '');
VATPostingSetup.ModifyAll("Purch. VAT Reporting Code", '');
Commit();
LibraryPermissions.SetTestabilitySoftwareAsAService(true);
SAFTSetupWizard.OpenEdit();
SAFTSetupWizard.ActionNext.Invoke();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,19 @@ codeunit 7250 "Bank Rec. AI Matching Impl."

procedure HasReservedWords(Input: Text): Boolean
begin
if StrPos(LowerCase(Input), '<|im_start|>') > 0 then
if StrPos(LowerCase(Input).Replace(' ', ''), '<|im_start|>') > 0 then
exit(true);

if StrPos(LowerCase(Input), '<|im_end|>') > 0 then
if StrPos(LowerCase(Input).Replace(' ', ''), '<|im_end|>') > 0 then
exit(true);

if StrPos(LowerCase(Input), '<|start|>') > 0 then
if StrPos(LowerCase(Input).Replace(' ', ''), '<|start|>') > 0 then
exit(true);

if StrPos(LowerCase(Input), '<|end|>') > 0 then
if StrPos(LowerCase(Input).Replace(' ', ''), '<|end|>') > 0 then
exit(true);

if StrPos(LowerCase(Input).Replace(' ', ''), '**task**') > 0 then
exit(true);

exit(false)
Expand Down
2 changes: 1 addition & 1 deletion Apps/W1/BankAccRecWithAI/test/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"idRanges": [
{
"from": 139777,
"to": 139778
"to": 139791
}
],
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2206176",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"input": "LID: 10000, Description: Here you go, Amount: -37500.00, Date: 2025-01-03\nLID: 20000, Description: For the chairs (1 of 2), Amount: -4250.00, Date: 2025-01-03\nLID: 30000, Description: For the chairs (2 of 2), Amount: -4000.00, Date: 2025-01-03\nLID: 40000, Description: Installment 1 for table, Amount: -6000.00, Date: 2025-01-28\nLID: 50000, Description: Installment 2 for table, Amount: -19000.00, Date: 2025-01-30\nLID: 60000, Description: 3 Invoices, Amount: -30750.00, Date: 2025-02-28\nLID: 70000, Description: Two orders (36668 and 35211), Amount: -8580.00, Date: 2025-04-04\nLID: 80000, Description: Hall lease; May 25, Amount: -52550.00, Date: 2025-05-03\nLID: 90000, Description: Payment for 108003, Amount: -500.00, Date: 2025-05-07\nLID: 100000, Description: For the carpet, Amount: -18750.00, Date: 2025-06-03\nLID: 110000, Description: Invoices 36455, 24054, 38661 and 37552more, Amount: -3250.00, Date: 2025-07-06\nAID: 1220, Name: Increases during the Year\nEID: 37, DocumentNo: 108017, Description: Order 106015, ExtDocNo: 18051, Amount: -37500, Date: 2025-01-01\nEID: 42, DocumentNo: 108018, Description: Order 106018, ExtDocNo: 24365, Amount: -8250, Date: 2025-01-01\nEID: 204, DocumentNo: 108001, Description: Invoice 108001, ExtDocNo: 25760, Amount: -25000, Date: 2025-01-26\nEID: 213, DocumentNo: 108019, Description: Order 106019, ExtDocNo: 27116, Amount: -5640, Date: 2025-02-01\nEID: 218, DocumentNo: 108020, Description: Order 106022, ExtDocNo: 27117, Amount: -8925, Date: 2025-02-01\nEID: 384, DocumentNo: 108002, Description: Invoice 108002, ExtDocNo: 35111, Amount: -750, Date: 2025-02-28\nEID: 389, DocumentNo: 108005, Description: Invoice 108005, ExtDocNo: 35112, Amount: -2500, Date: 2025-02-28\nEID: 394, DocumentNo: 108006, Description: Invoice 108006, ExtDocNo: 20053, Amount: -25000, Date: 2025-02-28\nEID: 409, DocumentNo: 108021, Description: Order 106020, ExtDocNo: 35211, Amount: -3780, Date: 2025-03-01\nEID: 593, DocumentNo: 108022, Description: Order 106021, ExtDocNo: 36668, Amount: -4800, Date: 2025-04-01\nEID: 746, DocumentNo: 108003, Description: Invoice 108003, ExtDocNo: 37552, Amount: -500, Date: 2025-04-30\nEID: 765, DocumentNo: 108023, Description: Order 106016, ExtDocNo: 21152, Amount: -52500, Date: 2025-05-01\nEID: 941, DocumentNo: 108004, Description: Invoice 108004, ExtDocNo: 38661, Amount: -1500, Date: 2025-05-31\nEID: 946, DocumentNo: 108007, Description: Invoice 108007, ExtDocNo: 24054, Amount: -750, Date: 2025-05-31\nEID: 967, DocumentNo: 108024, Description: Order 106017, ExtDocNo: 24057, Amount: -18750, Date: 2025-06-01\nEID: 1150, DocumentNo: 108008, Description: Invoice 108008, ExtDocNo: 36455, Amount: -500, Date: 2025-06-30","expected_output": "LID: 10000, EID: 37\nLID: 20000, EID: 42\nLID: 30000, EID: 42\nLID: 40000, AID: 204\nLID: 50000, EID: 204\nLID: 60000, EID: 384\nLID: 60000, EID: 389\nLID: 60000, EID: 394\nLID: 70000, EID: 409\nLID: 70000, EID: 593\nLID: 80000, EID: 765\nLID: 90000, EID: 746\nLID: 100000, EID: 967\nLID: 110000, EID: 941\nLID: 110000, EID: 946\nLID: 110000, EID: 1150\n"}
{"input": "LID: 10000, Description: Here you go, Amount: -37500.00, Date: 2025-01-03\nLID: 20000, Description: For the chairs (1 of 2), Amount: -4250.00, Date: 2025-01-03\nLID: 30000, Description: For the chairs (2 of 2), Amount: -4000.00, Date: 2025-01-03\nLID: 40000, Description: Installment 1 for table, Amount: -6000.00, Date: 2025-01-28\nLID: 50000, Description: Installment 2 for table, Amount: -19000.00, Date: 2025-01-30\nLID: 60000, Description: 3 Invoices, Amount: -30750.00, Date: 2025-02-28\nLID: 70000, Description: Two orders (36668 and 35211), Amount: -8580.00, Date: 2025-04-04\nLID: 80000, Description: Hall lease; May 25, Amount: -52550.00, Date: 2025-05-03\nLID: 90000, Description: Payment for 108003, Amount: -500.00, Date: 2025-05-07\nLID: 100000, Description: For the carpet, Amount: -18750.00, Date: 2025-06-03\nLID: 110000, Description: Invoices 36455; 24054; 38661 and 37552more, Amount: -3250.00, Date: 2025-07-06\nAID: 1220, Name: Increases during the Year\nEID: 37, DocumentNo: 108017, Description: Order 106015, ExtDocNo: 18051, Amount: -37500, Date: 2025-01-01\nEID: 42, DocumentNo: 108018, Description: Order chairs 106018, ExtDocNo: 24365, Amount: -8250, Date: 2025-01-01\nEID: 204, DocumentNo: 108001, Description: table Invoice 108001, ExtDocNo: 25760, Amount: -25000, Date: 2025-01-26\nEID: 213, DocumentNo: 108019, Description: Order 106019, ExtDocNo: 27116, Amount: -5640, Date: 2025-02-01\nEID: 218, DocumentNo: 108020, Description: Order 106022, ExtDocNo: 27117, Amount: -8925, Date: 2025-02-01\nEID: 384, DocumentNo: 108002, Description: Invoice 108002, ExtDocNo: 35111, Amount: -750, Date: 2025-02-28\nEID: 389, DocumentNo: 108005, Description: Invoice 108005, ExtDocNo: 35112, Amount: -2500, Date: 2025-02-28\nEID: 394, DocumentNo: 108006, Description: Invoice 108006, ExtDocNo: 20053, Amount: -25000, Date: 2025-02-28\nEID: 409, DocumentNo: 108021, Description: Order 106020, ExtDocNo: 35211, Amount: -3780, Date: 2025-03-01\nEID: 593, DocumentNo: 108022, Description: Order 106021, ExtDocNo: 36668, Amount: -4800, Date: 2025-04-01\nEID: 746, DocumentNo: 108003, Description: Invoice 108003, ExtDocNo: 37552, Amount: -500, Date: 2025-04-30\nEID: 765, DocumentNo: 108023, Description: Order 106016, ExtDocNo: 21152, Amount: -52550, Date: 2025-05-01\nEID: 941, DocumentNo: 108004, Description: Invoice 108004, ExtDocNo: 38661, Amount: -1500, Date: 2025-05-31\nEID: 946, DocumentNo: 108007, Description: Invoice 108007, ExtDocNo: 24054, Amount: -750, Date: 2025-05-31\nEID: 967, DocumentNo: 108024, Description: Order 106017, ExtDocNo: 24057, Amount: -18750, Date: 2025-06-01\nEID: 1150, DocumentNo: 108008, Description: Invoice 108008, ExtDocNo: 36455, Amount: -500, Date: 2025-06-30","expected_output": "LID: 10000, EID: 37\nLID: 20000, EID: 42\nLID: 30000, EID: 42\nLID: 40000, EID: 204\nLID: 50000, EID: 204\nLID: 60000, EID: 384\nLID: 60000, EID: 389\nLID: 60000, EID: 394\nLID: 70000, EID: 409\nLID: 70000, EID: 593\nLID: 80000, EID: 765\nLID: 90000, EID: 746\nLID: 100000, EID: 967\nLID: 110000, EID: 941\nLID: 110000, EID: 946\nLID: 110000, EID: 1150\n"}
Loading

0 comments on commit 7ca090c

Please sign in to comment.