Skip to content

Commit

Permalink
added lot no. information support
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gorski committed Oct 10, 2023
1 parent 1835404 commit 5962eee
Show file tree
Hide file tree
Showing 9 changed files with 329 additions and 5 deletions.
40 changes: 40 additions & 0 deletions BEYONDIT.ruleset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"rules": [
{
"id": "AD0001",
"action": "None"
},
{
"id": "AA0100",
"action": "None"
},
{
"id": "AS0011",
"action": "Warning",
"justification": "The identifier ‘{0}’ must have the prefix ‘{1}’."
},
{
"id": "AS0015",
"action": "None"
},
{
"id": "AS0051",
"action": "Info"
},
{
"id": "AA0214",
"action": "Hidden",
"justification": "Buggy, check https://github.com/microsoft/AL/issues/5665"
},
{
"id": "AS0084",
"action": "Hidden"
},
{
"id": "AA0072",
"action": "Hidden"
}
],
"name": "BEYONDIT",
"description": "Ruleset."
}
45 changes: 40 additions & 5 deletions al.code-workspace
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
{
"folders": [
{
"path": ".AL-Go"
}
{
"path": ".AL-Go"
},
{
"path": ".alpackages"
},
{
"path": "src"
}
],
"settings": {}
}
"settings": {
"CRS.FileNamePattern": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
"CRS.FileNamePatternExtensions": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
"CRS.FileNamePatternPageCustomizations": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
"CRS.OnSaveAlFileAction": "Rename",
"CRS.RenameWithGit": false,
"CRS.ObjectNamePrefix": "PTE BCC ",
"CRS.RemovePrefixFromFilename": true,
"workbench.iconTheme": "vscode-icons",
"todo-tree.highlights.enabled": true,
"telemetry.enableTelemetry": false,
"editor.quickSuggestionsDelay": 2,
"editor.suggestSelection": "first",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
"editor.tabCompletion": "onlySnippets",
"al.enableCodeActions": true,
"al.enableCodeAnalysis": true,
"al.codeAnalyzers": [
"${CodeCop}",
"${UICop}"
],
"al.ruleSetPath": "..\\BEYONDIT.ruleset.json",
"al.packageCachePath": "..\\.alpackages",
"al-test-runner.sendDebugTelemetry": false
}
}

19 changes: 19 additions & 0 deletions src/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Microsoft cloud sandbox",
"request": "launch",
"type": "al",
"environmentType": "Sandbox",
"environmentName": "Demo",
"startupObjectId": 22,
"startupObjectType": "Page",
"breakOnError": "All",
"launchBrowser": true,
"enableLongRunningSqlStatements": true,
"enableSqlInformationDebugger": true,
"tenant": "me3n.de"
}
]
}
24 changes: 24 additions & 0 deletions src/InstallConnector.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codeunit 60010 "PTE BCC Install Connector"
{
Subtype = Install;

trigger OnInstallAppPerCompany()
begin
InstallCCApp();
end;

procedure InstallCCApp()
var
ReasonLbl: Label 'PTE-BCC-INSTALL-2023-10.2', Locked = true;
begin
if UpgradeTag.HasUpgradeTag(ReasonLbl) then
exit;

Codeunit.Run(Codeunit::"PTE BCC Install Custom Table");

UpgradeTag.SetUpgradeTag(ReasonLbl);
end;

var
UpgradeTag: Codeunit "Upgrade Tag";
}
58 changes: 58 additions & 0 deletions src/InstallCustomTable.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
codeunit 60011 "PTE BCC Install Custom Table"
{
trigger OnRun()
begin
CreateDropzoneTables();
end;

local procedure CreateDropzoneTables()
begin
InsertDropzoneTable(Database::"Lot No. Information");
InsertCloudStorage(Database::"Lot No. Information", 'Lot No. Information');
ActivateDropzoneForAllUsers(Database::"Lot No. Information");
end;

local procedure InsertDropzoneTable(Id: Integer)
var
DropzoneTable: Record "BYD Dropzone Table";
begin
if not DropzoneTable.Get(Id) then begin
DropzoneTable.Init();
DropzoneTable.ID := Id;
DropzoneTable.Insert();
end;
end;

local procedure InsertCloudStorage(Id: Integer; FolrderName: Text)
var
CloudStorage: Record "BYD Cloud Storage";
begin
if not CloudStorage.Get(CloudStorage.Type::Dropzone, Id) then begin
CloudStorage.Init();
CloudStorage.Type := CloudStorage.Type::Dropzone;
CloudStorage."Table ID" := Id;
CloudStorage.Foldername := FolrderName;
CloudStorage.Insert();
end;
end;

local procedure ActivateDropzoneForAllUsers(Id: Integer)
var
CloudConnectorUserSetup: Record "BYD Cloud Connector User Setup";
User: Record User;
begin
User.SetRange(State, User.State::Enabled);
User.SetFilter("License Type", '%1|%2', User."License Type"::"Full User", User."License Type"::"Limited User");
if User.FindSet() then
repeat
if not CloudConnectorUserSetup.Get(User."User Name", Id) then begin
CloudConnectorUserSetup.Init();
CloudConnectorUserSetup."User ID" := User."User Name";
CloudConnectorUserSetup."Dropzone Enabled" := true;
CloudConnectorUserSetup."File Preview Enabled" := true;
CloudConnectorUserSetup."Table No." := Id;
CloudConnectorUserSetup.Insert();
end;
until User.Next() = 0;
end;
}
49 changes: 49 additions & 0 deletions src/LotNoInfoCard.PageExt.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pageextension 60010 "PTE BCC Lot No. Info. Card" extends "Lot No. Information Card"
{
layout
{
addfirst(factboxes)
{
part("PTE BCC Dropzone"; "BYD Dropzone Fact Box")
{
ApplicationArea = All;
Visible = PTEBCCIsDropzoneReady and PTEBCCIsDropzoneVisible;
}
part("PTE BCC FilePreview"; "BYD File Preview")
{
ApplicationArea = All;
Visible = PTEBCCIsDropzoneReady and PTEBCCIsFilePreviewVisible;
Provider = "PTE BCC Dropzone";
SubPageLink = "File No." = field("File No.");
}
}
}

trigger OnOpenPage()
var
CloudStorageMgt: Codeunit "BYD Cloud Storage Mgt.";
begin
PTEBCCIsDropzoneReady := CurrPage."PTE BCC Dropzone".Page.IsDropzoneReady(Rec.RecordId().TableNo());
PTEBCCIsDropzoneVisible := CloudStorageMgt.DropzoneVisible(Rec.RecordId().TableNo());
PTEBCCIsFilePreviewVisible := CloudStorageMgt.FilePreviewVisible(Rec.RecordId().TableNo());
end;

trigger OnInsertRecord(BelowxRec: Boolean): Boolean
var
EmptyRecId: RecordId;
begin
if Rec.RecordId() <> EmptyRecId then
CurrPage.Update();
end;

trigger OnAfterGetCurrRecord()
begin
CurrPage."PTE BCC Dropzone".Page.SetRecID(Rec.RecordId());
CurrPage."PTE BCC FilePreview".Page.SetRecID(Rec.RecordId());
end;

var
PTEBCCIsDropzoneReady: Boolean;
PTEBCCIsDropzoneVisible: Boolean;
PTEBCCIsFilePreviewVisible: Boolean;
}
49 changes: 49 additions & 0 deletions src/LotNoInfoList.PageExt.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pageextension 60011 "PTE BCC Lot No. Info. List" extends "Lot No. Information List"
{
layout
{
addfirst(factboxes)
{
part("PTE BCC Dropzone"; "BYD Dropzone Fact Box")
{
ApplicationArea = All;
Visible = PTEBCCIsDropzoneReady and PTEBCCIsDropzoneVisible;
}
part("PTE BCC FilePreview"; "BYD File Preview")
{
ApplicationArea = All;
Visible = PTEBCCIsDropzoneReady and PTEBCCIsFilePreviewVisible;
Provider = "PTE BCC Dropzone";
SubPageLink = "File No." = field("File No.");
}
}
}

trigger OnOpenPage()
var
CloudStorageMgt: Codeunit "BYD Cloud Storage Mgt.";
begin
PTEBCCIsDropzoneReady := CurrPage."PTE BCC Dropzone".Page.IsDropzoneReady(Rec.RecordId().TableNo());
PTEBCCIsDropzoneVisible := CloudStorageMgt.DropzoneVisible(Rec.RecordId().TableNo());
PTEBCCIsFilePreviewVisible := CloudStorageMgt.FilePreviewVisible(Rec.RecordId().TableNo());
end;

trigger OnInsertRecord(BelowxRec: Boolean): Boolean
var
EmptyRecId: RecordId;
begin
if Rec.RecordId() <> EmptyRecId then
CurrPage.Update();
end;

trigger OnAfterGetCurrRecord()
begin
CurrPage."PTE BCC Dropzone".Page.SetRecID(Rec.RecordId());
CurrPage."PTE BCC FilePreview".Page.SetRecID(Rec.RecordId());
end;

var
PTEBCCIsDropzoneReady: Boolean;
PTEBCCIsDropzoneVisible: Boolean;
PTEBCCIsFilePreviewVisible: Boolean;
}
40 changes: 40 additions & 0 deletions src/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "1abb9a0c-56ed-47b8-9446-a95427e05233",
"name": "BeyondCloudConnector-Lot",
"publisher": "BEYONDIT GmbH",
"version": "1.0.0.1",
"brief": "Beyond-CloudConnector Extension for Lot No. Information.",
"description": "Visit https://www.beyondit.gmbh/",
"url": "https://beyondit.gmbh",
"supportedLocales": [
"de-DE",
"en-US"
],
"propagateDependencies": true,
"dependencies": [
{
"id": "7367e644-7294-4a21-b213-942359a67ed5",
"name": "BeyondCloudConnector",
"publisher": "BEYONDIT GmbH",
"version": "18.0.0.0"
}
],
"application": "22.0.0.0",
"platform": "22.0.0.0",
"idRanges": [
{
"from": 60010,
"to": 60015
}
],
"resourceExposurePolicy": {
"allowDownloadingSource": false,
"allowDebugging": true
},
"runtime": "11.0",
"features": [
"TranslationFile",
"NoImplicitWith"
],
"target": "Cloud"
}
10 changes: 10 additions & 0 deletions src/src/All.PermissionSet.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
permissionset 60010 "PTE BCC All"
{
Access = Internal;
Assignable = true;
Caption = 'BeyondCloudConnector-Lot All permissions', Locked = true;

Permissions =
codeunit "PTE BCC Install Connector" = X,
codeunit "PTE BCC Install Custom Table" = X;
}

0 comments on commit 5962eee

Please sign in to comment.