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

[25.x] Use AppId function to delete orphaned extension data AB#557275 #2343

Merged
merged 1 commit into from
Nov 15, 2024
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 @@ -53,7 +53,8 @@ codeunit 2500 "Extension Installation Impl"
exit(not NAVAppInstalledApp.IsEmpty());
end;

procedure IsInstalledByAppId(AppID: Guid): Boolean

procedure IsInstalledByAppId(AppId: Guid): Boolean
var
[SecurityFiltering(SecurityFilter::Ignored)]
NAVAppInstalledApp: Record "NAV App Installed App";
Expand Down Expand Up @@ -209,15 +210,15 @@ codeunit 2500 "Extension Installation Impl"
exit(UninstallExtensionSilently(PackageID, ClearSchema, ClearSchema));
end;

procedure DeleteOrphanData(PackageID: Guid; ExtensionName: Text): Boolean
procedure DeleteOrphanData(AppId: Guid; ExtensionName: Text): Boolean
var
ConfirmManagement: Codeunit "Confirm Management";
begin
CheckPermissions();

if not ConfirmManagement.GetResponse(StrSubstNo(ClearExtensionSchemaOrphanMsg, ExtensionName), false) then exit(false);

exit(UninstallExtensionSilently(PackageID, false, true));
exit(UninstallExtensionSilentlyByAppId(AppId, false, true));
end;

procedure RunOrphanDeletion(OrphanedApplication: Record "Extension Database Snapshot"): Boolean
Expand All @@ -228,7 +229,6 @@ codeunit 2500 "Extension Installation Impl"
exit(OrphanedExtensionDetails.RunModal() = Action::OK);
end;


local procedure UninstallExtensionSilently(PackageID: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
begin
CheckPermissions();
Expand All @@ -241,6 +241,18 @@ codeunit 2500 "Extension Installation Impl"
exit(true);
end;

local procedure UninstallExtensionSilentlyByAppId(AppId: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
begin
CheckPermissions();
AssertIsInitialized();
DotNetNavAppALInstaller.ALUninstallNavAppByAppId(AppId, ClearData, ClearSchema);

if IsInstalledByAppId(AppId) then
exit(false);

exit(true);
end;

procedure UninstallExtensionWithConfirmDialog(PackageId: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
var
PublishedApplication: Record "Published Application";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ page 2513 "Extn. Orphaned App Details"

trigger OnAction()
begin
ExtensionInstallationImpl.DeleteOrphanData(Rec."Package Id", Rec."Name");
ExtensionInstallationImpl.DeleteOrphanData(Rec."App Id", Rec."Name");
CurrPage.Close();
end;
}
Expand Down
Loading