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

[24.x] Update all modules to latest versions from main branch #1098

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions src/Business Foundation/App/NoSeries/readme_refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if "No." = '' then begin
GLSetup.TestField("Bank Account Nos.");
"No. Series" := GLSetup."Bank Account Nos.";
if NoSeries.AreRelated(GLSetup."Bank Account Nos.", xRec."No. Series") then
"No. Series" := xRec."No. Series"
"No. Series" := xRec."No. Series";
"No." := NoSeries.GetNextNo("No. Series");
end;
```
Expand All @@ -70,7 +70,7 @@ if "No." = '' then begin
if not IsHandled then begin
"No. Series" := GLSetup."Bank Account Nos.";
if NoSeries.AreRelated(GLSetup."Bank Account Nos.", xRec."No. Series") then
"No. Series" := xRec."No. Series"
"No. Series" := xRec."No. Series";
"No." := NoSeries.GetNextNo("No. Series");
NoSeriesManagement.RaiseObsoleteOnAfterInitSeries("No. Series", GLSetup."Bank Account Nos.", 0D, "No.");
end;
Expand Down Expand Up @@ -132,7 +132,7 @@ end;
```
New:
```
"Document No." := NoSeriesBatch.SimulateGetNextNo(GenJnlBatch."No. Series", Rec."Posting Date", "Document No.")
"Document No." := NoSeriesBatch.SimulateGetNextNo(GenJnlBatch."No. Series", Rec."Posting Date", "Document No.");
```

This new function uses the details of the given number series to increment the document number. If the number series doesn't exist, the document number increases by one.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@

SendTokenCountTelemetry(AOAIToken.GetGPT4TokenCount(Metaprompt), AOAIToken.GetGPT4TokenCount(Prompt), CustomDimensions);

if not SendRequest(Enum::"AOAI Model Type"::"Text Completions", TextCompletionsAOAIAuthorization, PayloadText, AOAIOperationResponse) then begin
if not SendRequest(Enum::"AOAI Model Type"::"Text Completions", TextCompletionsAOAIAuthorization, PayloadText, AOAIOperationResponse, CallerModuleInfo) then begin
FeatureTelemetry.LogError('0000KVD', CopilotCapabilityImpl.GetAzureOpenAICategory(), TelemetryGenerateTextCompletionLbl, CompletionsFailedWithCodeErr, '', CustomDimensions);
exit;
end;
Expand All @@ -269,7 +269,7 @@

AddTelemetryCustomDimensions(CustomDimensions, CallerModuleInfo);
SendTokenCountTelemetry(0, AOAIToken.GetAdaTokenCount(Input), CustomDimensions);
if not SendRequest(Enum::"AOAI Model Type"::Embeddings, EmbeddingsAOAIAuthorization, PayloadText, AOAIOperationResponse) then begin
if not SendRequest(Enum::"AOAI Model Type"::Embeddings, EmbeddingsAOAIAuthorization, PayloadText, AOAIOperationResponse, CallerModuleInfo) then begin
FeatureTelemetry.LogError('0000KVE', CopilotCapabilityImpl.GetAzureOpenAICategory(), TelemetryGenerateEmbeddingLbl, EmbeddingsFailedWithCodeErr, '', CustomDimensions);
exit;
end;
Expand Down Expand Up @@ -342,7 +342,7 @@
Payload.WriteTo(PayloadText);

SendTokenCountTelemetry(MetapromptTokenCount, PromptTokenCount, CustomDimensions);
if not SendRequest(Enum::"AOAI Model Type"::"Chat Completions", ChatCompletionsAOAIAuthorization, PayloadText, AOAIOperationResponse) then begin
if not SendRequest(Enum::"AOAI Model Type"::"Chat Completions", ChatCompletionsAOAIAuthorization, PayloadText, AOAIOperationResponse, CallerModuleInfo) then begin
FeatureTelemetry.LogError('0000KVF', CopilotCapabilityImpl.GetAzureOpenAICategory(), TelemetryGenerateChatCompletionLbl, ChatCompletionsFailedWithCodeErr, '', CustomDimensions);
exit;
end;
Expand Down Expand Up @@ -472,23 +472,26 @@

[TryFunction]
[NonDebuggable]
local procedure SendRequest(ModelType: Enum "AOAI Model Type"; AOAIAuthorization: Codeunit "AOAI Authorization"; Payload: Text; var AOAIOperationResponse: Codeunit "AOAI Operation Response")
local procedure SendRequest(ModelType: Enum "AOAI Model Type"; AOAIAuthorization: Codeunit "AOAI Authorization"; Payload: Text; var AOAIOperationResponse: Codeunit "AOAI Operation Response"; CallerModuleInfo: ModuleInfo)
var
ALCopilotAuthorization: DotNet ALCopilotAuthorization;
ALCopilotCapability: DotNet ALCopilotCapability;

Check failure on line 478 in src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application (Clean) / System Application (Clean)

AL0185 DotNet 'ALCopilotCapability' is missing

Check failure on line 478 in src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application (Default) / System Application (Default)

AL0185 DotNet 'ALCopilotCapability' is missing

Check failure on line 478 in src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build System Application (Translated) / System Application (Translated)

AL0185 DotNet 'ALCopilotCapability' is missing
ALCopilotFunctions: DotNet ALCopilotFunctions;
ALCopilotOperationResponse: DotNet ALCopilotOperationResponse;
Error: Text;
begin
ClearLastError();
ALCopilotAuthorization := ALCopilotAuthorization.Create(AOAIAuthorization.GetEndpoint(), AOAIAuthorization.GetDeployment(), AOAIAuthorization.GetApiKey());

ALCopilotCapability := ALCopilotCapability.ALCopilotCapability(CallerModuleInfo.Publisher(), CallerModuleInfo.Id(), Format(CallerModuleInfo.AppVersion()), GetCapabilityName());

case ModelType of
Enum::"AOAI Model Type"::"Text Completions":
ALCopilotOperationResponse := ALCopilotFunctions.GenerateTextCompletion(Payload, ALCopilotAuthorization);
ALCopilotOperationResponse := ALCopilotFunctions.GenerateTextCompletion(Payload, ALCopilotAuthorization, ALCopilotCapability);
Enum::"AOAI Model Type"::Embeddings:
ALCopilotOperationResponse := ALCopilotFunctions.GenerateEmbedding(Payload, ALCopilotAuthorization);
ALCopilotOperationResponse := ALCopilotFunctions.GenerateEmbedding(Payload, ALCopilotAuthorization, ALCopilotCapability);
Enum::"AOAI Model Type"::"Chat Completions":
ALCopilotOperationResponse := ALCopilotFunctions.GenerateChatCompletion(Payload, ALCopilotAuthorization);
ALCopilotOperationResponse := ALCopilotFunctions.GenerateChatCompletion(Payload, ALCopilotAuthorization, ALCopilotCapability);
else
Error(InvalidModelTypeErr)
end;
Expand All @@ -502,6 +505,22 @@
Error(GenerateRequestFailedErr);
end;

local procedure GetCapabilityName(): Text
var
CapabilityIndex: Integer;
CapabilityName: Text;
begin
CheckCapabilitySet();

CapabilityIndex := CopilotSettings.Capability.Ordinals.IndexOf(CopilotSettings.Capability.AsInteger());
CapabilityName := CopilotSettings.Capability.Names.Get(CapabilityIndex);

if CapabilityName.Trim() = '' then
exit(Format(CopilotSettings.Capability, 0, 9));

exit(CapabilityName);
end;

[NonDebuggable]
local procedure SendTokenCountTelemetry(Metaprompt: Integer; Prompt: Integer; CustomDimensions: Dictionary of [Text, Text])
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ codeunit 7774 "Copilot Capability Impl"
NotRegisteredErr: Label 'Copilot capability has not been registered by the module.';
ReviewPrivacyNoticeLbl: Label 'Review the privacy notice';
PrivacyNoticeDisagreedNotificationMessageLbl: Label 'To enable Copilot, please review and accept the privacy notice.';
CapabilitiesNotAvailableOnPremNotificationMessageLbl: Label 'Note that copilot and AI capabilities published by Microsoft are not available on-premises.';
CapabilitiesNotAvailableOnPremNotificationMessageLbl: Label 'Copilot capabilities published by Microsoft are not available on-premises. You can extend Copilot with custom capabilities and use them on-premises for development purposes only.';
TelemetryRegisteredNewCopilotCapabilityLbl: Label 'New copilot capability has been registered.', Locked = true;
TelemetryModifiedCopilotCapabilityLbl: Label 'Copilot capability has been modified.', Locked = true;
TelemetryUnregisteredCopilotCapabilityLbl: Label 'Copilot capability has been unregistered.', Locked = true;
Expand Down Expand Up @@ -239,7 +239,7 @@ codeunit 7774 "Copilot Capability Impl"
IsAdmin := AzureADGraphUser.IsUserDelegatedAdmin() or AzureADPlan.IsPlanAssignedToUser(PlanIds.GetGlobalAdminPlanId()) or AzureADPlan.IsPlanAssignedToUser(PlanIds.GetBCAdminPlanId()) or AzureADPlan.IsPlanAssignedToUser(PlanIds.GetD365AdminPlanId()) or AzureADGraphUser.IsUserDelegatedHelpdesk() or UserPermissions.IsSuper(UserSecurityId());
end;

[Tryfunction]
[TryFunction]
procedure CheckGeo(var WithinGeo: Boolean; var WithinEuropeGeo: Boolean)
var
ALCopilotFunctions: DotNet ALCopilotFunctions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ page 2516 "AppSource Product Details"
{
Caption = 'Legal Terms Uri';
ToolTip = 'Specifies the legal terms of the offer.';
ExtendedDatatype = Url;
ExtendedDatatype = URL;
}
field(Links_PrivacyPolicyUri; AppSourceJsonUtilities.GetStringValue(ProductObject, 'privacyPolicyUri'))
{
Caption = 'Privacy Policy Uri';
ToolTip = 'Specifies the privacy policy of the offer.';
ExtendedDatatype = Url;
ExtendedDatatype = URL;
}
field(Links_SupportUri; AppSourceJsonUtilities.GetStringValue(ProductObject, 'supportUri'))
{
Caption = 'Support Uri';
ToolTip = 'Specifies the support Uri of the offer.';
ExtendedDatatype = Url;
ExtendedDatatype = URL;
}
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ page 2516 "AppSource Product Details"
Enabled = CurrentRecordCanBeUninstalled;
Image = Delete;
ToolTip = 'Uninstalls the app.';
AccessByPermission = TableData "Installed Application" = d;
AccessByPermission = tabledata "Installed Application" = d;

trigger OnAction()
begin
Expand Down Expand Up @@ -313,9 +313,9 @@ page 2516 "AppSource Product Details"
AvailabilityObject: JsonObject;
TermItem: JsonToken;
ArrayItem: JsonArray;
i: integer;
Currency: text;
Monthly, Yearly : decimal;
i: Integer;
Currency: Text;
Monthly, Yearly : Decimal;
FreeTrial: Boolean;
PriceText: Text;
begin
Expand Down Expand Up @@ -363,13 +363,13 @@ page 2516 "AppSource Product Details"
exit(true);
end;

local procedure GetTerms(Terms: JsonArray; var Monthly: decimal; var Yearly: decimal; var Currency: Text)
local procedure GetTerms(Terms: JsonArray; var Monthly: Decimal; var Yearly: Decimal; var Currency: Text)
var
Item: JsonToken;
PriceToken: JsonToken;
Price: JsonObject;
PriceValue: Decimal;
i: integer;
i: Integer;
begin
for i := 0 to Terms.Count() do
if (Terms.Get(i, Item)) then begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ page 2515 "AppSource Product List"
action(ShowSettings)
{
Caption = 'Edit User Settings';
RunObject = Page "User Settings";
RunObject = page "User Settings";
Image = UserSetup;
ToolTip = 'Locale will be used to determine the market and language will be used to determine the language of the app details listed here.';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ codeunit 2515 "AppSource Product Manager"
var
AppSourceJsonUtilities: Codeunit "AppSource Json Utilities";
AppSourceProductManagerDependencies: Interface "AppSource Product Manager Dependencies";
IsDependenciesInterfaceSet: boolean;
CatalogProductsUriLbl: label 'https://catalogapi.azure.com/products', Locked = true;
CatalogApiVersionQueryParamNameLbl: label 'api-version', Locked = true;
CatalogApiVersionQueryParamValueLbl: label '2023-05-01-preview', Locked = true;
CatalogApiOrderByQueryParamNameLbl: label '$orderby', Locked = true;
CatalogMarketQueryParamNameLbl: label 'market', Locked = true;
CatalogLanguageQueryParamNameLbl: label 'language', Locked = true;
IsDependenciesInterfaceSet: Boolean;
CatalogProductsUriLbl: Label 'https://catalogapi.azure.com/products', Locked = true;
CatalogApiVersionQueryParamNameLbl: Label 'api-version', Locked = true;
CatalogApiVersionQueryParamValueLbl: Label '2023-05-01-preview', Locked = true;
CatalogApiOrderByQueryParamNameLbl: Label '$orderby', Locked = true;
CatalogMarketQueryParamNameLbl: Label 'market', Locked = true;
CatalogLanguageQueryParamNameLbl: Label 'language', Locked = true;
CatalogApiFilterQueryParamNameLbl: Label '$filter', Locked = true;
CatalogApiSelectQueryParamNameLbl: Label '$select', Locked = true;
AppSourceListingUriLbl: Label 'https://appsource.microsoft.com/%1/product/dynamics-365-business-central/%2', Comment = '%1=Language ID, such as en-US, %2=Url Query Content', Locked = true;
Expand Down Expand Up @@ -137,7 +137,7 @@ codeunit 2515 "AppSource Product Manager"
procedure ResolveMarketAndLanguage(var Market: Code[2]; var LanguageName: Text)
var
Language: Codeunit Language;
LanguageID, LocalID : integer;
LanguageID, LocalID : Integer;
begin
GetCurrentUserLanguageAndLocaleID(LanguageID, LocalID);

Expand Down Expand Up @@ -264,10 +264,10 @@ codeunit 2515 "AppSource Product Manager"
/// <summary>
/// Get all products from a remote server and adds them to the AppSource Product table.
/// </summary>
internal procedure GetProductsAndPopulateRecord(var AppSourceProductRec: record "AppSource Product"): Text
internal procedure GetProductsAndPopulateRecord(var AppSourceProductRec: Record "AppSource Product"): Text
var
RestClient: Codeunit "Rest Client";
NextPageLink: text;
NextPageLink: Text;
begin
Init();
NextPageLink := ConstructProductListUri();
Expand Down Expand Up @@ -313,7 +313,7 @@ codeunit 2515 "AppSource Product Manager"
exit(AppSourceProductManagerDependencies.GetAsJSon(RestClient, RequestUri).AsObject());
end;

local procedure DownloadAndAddNextPageProducts(NextPageLink: Text; var AppSourceProductRec: record "AppSource Product"; var RestClient: Codeunit "Rest Client"): Text
local procedure DownloadAndAddNextPageProducts(NextPageLink: Text; var AppSourceProductRec: Record "AppSource Product"; var RestClient: Codeunit "Rest Client"): Text
var
ResponseObject: JsonObject;
ProductArray: JsonArray;
Expand Down Expand Up @@ -392,7 +392,7 @@ codeunit 2515 "AppSource Product Manager"
end;

#region Telemetry helpers
local procedure PopulateTelemetryDictionary(RequestID: Text; UniqueIdentifier: text; Uri: Text; var TelemetryDictionary: Dictionary of [Text, Text])
local procedure PopulateTelemetryDictionary(RequestID: Text; UniqueIdentifier: Text; Uri: Text; var TelemetryDictionary: Dictionary of [Text, Text])
begin
PopulateTelemetryDictionary(RequestID, telemetryDictionary);
TelemetryDictionary.Add('UniqueIdentifier', UniqueIdentifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ codeunit 2518 "AppSrc Product Deps. Provider" implements "AppSource Product Mana
exit(EnvironmentInformation.GetApplicationFamily());
end;

procedure IsSaas(): boolean
procedure IsSaas(): Boolean
var
EnvironmentInformation: Codeunit "Environment Information";
begin
Expand All @@ -59,7 +59,7 @@ codeunit 2518 "AppSrc Product Deps. Provider" implements "AppSource Product Mana
exit(RestClient.GetAsJSon(RequestUri));
end;

procedure GetUserSettings(UserSecurityId: Guid; var TempUserSettingsRecord: record "User Settings" temporary)
procedure GetUserSettings(UserSecurityId: Guid; var TempUserSettingsRecord: Record "User Settings" temporary)
var
UserSettings: Codeunit "User Settings";
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ codeunit 433 "Azure AD Tenant"
/// <summary>
/// Gets the Microsoft Entra tenant ID.
/// </summary>
/// <returns>If it cannot be found, an empty string is returned.</returns>
/// <returns>If the Entra tenant ID is a valid GUID, it will be returned in lowercase format and without brackets or parentheses (as per RFC4122 section 3), such as "f81d4fae-7dec-11d0-a765-00a0c91e6bf6". If it cannot be found, an empty string is returned.</returns>
procedure GetAadTenantId(): Text
begin
exit(AzureADTenantImpl.GetAadTenantId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ codeunit 3705 "Azure AD Tenant Impl."
CountryLetterCodeErr: Label 'Failed to retrieve the Microsoft Entra tenant country letter code.';
PreferredLanguageErr: Label 'Failed to retrieve the Microsoft Entra tenant preferred language code.';

procedure GetAadTenantId() TenantIdValue: Text
procedure GetAadTenantId(): Text
var
TenantIdValue: Text;
EntraTenantIdAsGuid: Guid;
begin
NavTenantSettingsHelper.TryGetStringTenantSetting('AADTENANTID', TenantIdValue);

if Evaluate(EntraTenantIdAsGuid, TenantIdValue) then
exit(LowerCase(Format(EntraTenantIdAsGuid, 0, 4)));

exit(TenantIdValue);
end;

procedure GetAadTenantDomainName(): Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ page 9515 "Azure AD User Update Wizard"
var
UserPermissions: Codeunit "User Permissions";
begin
if not UserPermissions.CanManageUsersOnTenant(UserSecurityId()) then
if not (UserPermissions.CanManageUsersOnTenant(UserSecurityId()) and UserPermissions.IsSuper(UserSecurityId())) then
Error(CannotUpdateUsersFromOfficeErr);

MakeAllGroupsInvisible();
Expand Down
Loading
Loading