Skip to content

Commit

Permalink
Merge pull request #220 from PeterConijn/PatternFixes
Browse files Browse the repository at this point in the history
Minor fixes to pattern pages
  • Loading branch information
JeremyVyska authored Sep 28, 2023
2 parents 9812ecc + 6bb60cb commit 00e6968
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
3 changes: 3 additions & 0 deletions content/docs/patterns/facade-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ To achieve this, we are using [access modifiers](https://docs.microsoft.com/bs-c
_The Facade_

```AL
/// <summary>
/// Codeunit to extract image information.
/// </summary>
codeunit 3971 Image
{
Access = Public;
Expand Down
18 changes: 12 additions & 6 deletions content/docs/patterns/generic-method-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ codeunit 53100 "WLD BlockCustomer Meth"
var
IsHandled: Boolean;
begin
if not ConfirmBlockCustomer(HideDialog) then exit;
if not ConfirmBlockCustomer(HideDialog) then
exit;
OnBeforeBlockCustomer(Cust, IsHandled);
DoBlockCustomer(Cust, IsHandled);
OnAfterBlockCustomer(Cust);
Expand All @@ -77,15 +78,17 @@ codeunit 53100 "WLD BlockCustomer Meth"
begin
DefaultAnswer := true;
if HideDialog then exit(DefaultAnswer);
if HideDialog then
exit(DefaultAnswer);
exit(ConfirmManagement.GetResponseOrDefault(ConfirmQst, DefaultAnswer));
end;
local procedure AcknowledgeBlockCustomer(HideDialog: Boolean)
var
AcknowledgeMsg: Label 'You successfully executed "BlockCustomer"';
begin
if not GuiAllowed or HideDialog then exit;
if not GuiAllowed or HideDialog then
exit;
Message(AcknowledgeMsg);
end;
Expand Down Expand Up @@ -126,7 +129,8 @@ codeunit 53100 "WLD BlockCustomer Meth"
var
IsHandled: Boolean;
begin
if not ConfirmBlockCustomer(HideDialog) then exit;
if not ConfirmBlockCustomer(HideDialog) then
exit;
...
AcknowledgeBlockCustomer(HideDialog)
end;
Expand All @@ -140,15 +144,17 @@ codeunit 53100 "WLD BlockCustomer Meth"
begin
DefaultAnswer := true;
if HideDialog then exit(DefaultAnswer);
if HideDialog then
exit(DefaultAnswer);
exit(ConfirmManagement.GetResponseOrDefault(ConfirmQst, DefaultAnswer));
end;
local procedure AcknowledgeBlockCustomer(HideDialog: Boolean)
var
AcknowledgeMsg: Label 'You successfully executed "BlockCustomer"';
begin
if not GuiAllowed or HideDialog then exit;
if not GuiAllowed or HideDialog then
exit;
Message(AcknowledgeMsg);
end;
...
Expand Down
25 changes: 12 additions & 13 deletions content/docs/patterns/template-method-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,15 @@ We start with the template
```al
codeunit 50000 ExportTemplate
{
procedure ExportData(export: Interface IDataExport)
procedure ExportData(Export: Interface IDataExport)
begin
if not export.CheckData() then
if not Export.CheckData() then
exit;
if export.GetLinesToExport() then begin
if Export.GetLinesToExport() then
repeat
export.ExportLine();
until not export.NextLine();
end;
export.Finish();
Export.ExportLine();
until not Export.NextLine();
Export.Finish();
end;
}
```
Expand Down Expand Up @@ -132,13 +131,13 @@ codeunit 50002 ExportOrders
{
procedure ExportOrder(DocType: Enum "Sales Document Type"; No: Code[10])
var
export: Codeunit ExportTemplate;
exportImpl: Codeunit SalesHeaderExport;
exportInt: Interface IDataExport;
Export: Codeunit ExportTemplate;
ExportImpl: Codeunit SalesHeaderExport;
ExportInt: Interface IDataExport;
begin
exportImpl.SetSalesHeader(DocType, No);
exportInt := exportImpl;
export.ExportData(exportInt);
ExportImpl.SetSalesHeader(DocType, No);
ExportInt := exportImpl;
Export.ExportData(exportInt);
end;
}
```
Expand Down

0 comments on commit 00e6968

Please sign in to comment.