Skip to content

Commit

Permalink
Fixed remaning Rulesets
Browse files Browse the repository at this point in the history
  • Loading branch information
finnpedersenkazes committed Dec 20, 2023
1 parent c0ff2c5 commit 68b95b0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .vscode/AfterConversion.ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
},
{
"id": "AA0072",
"action": "None",
"action": "Error",
"justification": "The name of variables and parameters must be suffixed with the type or object name. BEST PRACTICES."
},
{
Expand All @@ -169,7 +169,7 @@
},
{
"id": "AA0217",
"action": "None",
"action": "Error",
"justification": "Use a text constant or label for format string in StrSubstNo. BEST PRACTICES."
},
{
Expand Down
6 changes: 3 additions & 3 deletions App/NextPeriodeCalcBatch.Report.al
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ report 50140 "Next Periode Calc Batch"
Counter := Counter + 1;
WindowDialog.Update(1, "No.");
WindowDialog.Update(2, ROUND(Counter / CounterTotal * 10000, 1));
Clear(FPFrSubscriptionManagement);
FPFrSubscriptionManagement.CalculateNextSubscriptionPeriodOne("Sales Header");
Clear(SubscriptionManagement);
SubscriptionManagement.CalculateNextSubscriptionPeriodOne("Sales Header");
CounterOK := CounterOK + 1;
if MarkedOnly then
Mark(false);
Expand Down Expand Up @@ -63,7 +63,7 @@ report 50140 "Next Periode Calc Batch"
}

var
FPFrSubscriptionManagement: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
UpdatingBlanketOrdersLbl: label 'Updating Blanket Orders #1########## @2@@@@@@@@@@@@@', Comment = '%1 = Order Number; %2 = Counter';
CounterLbl: label '%1 blanket orders out of a total of %2 have now been evaluated.', Comment = '%1 = Counter; %2 = Counter Total';
WindowDialog: Dialog;
Expand Down
6 changes: 3 additions & 3 deletions App/QtyToShipCalcBatch.Report.al
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ report 50141 "Qty to Ship Calc Batch"
Counter := Counter + 1;
WindowDialog.Update(1, "No.");
WindowDialog.Update(2, ROUND(Counter / CounterTotal * 10000, 1));
Clear(FPFrSubscriptionManagement);
FPFrSubscriptionManagement.CalculateQuantityToShipOne("Sales Header");
Clear(SubscriptionManagement);
SubscriptionManagement.CalculateQuantityToShipOne("Sales Header");
CounterOK := CounterOK + 1;
if MarkedOnly then
Mark(false);
Expand Down Expand Up @@ -63,7 +63,7 @@ report 50141 "Qty to Ship Calc Batch"
}

var
FPFrSubscriptionManagement: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
UpdatingBlanketOrdersLbl: label 'Updating Blanket Orders #1########## @2@@@@@@@@@@@@@', Comment = '%1 = Order Number; %2 = Counter';
CounterLbl: label '%1 blanket orders out of a total of %2 have now been evaluated.', Comment = '%1 = Counter; %2 = Counter Total';
WindowDialog: Dialog;
Expand Down
12 changes: 6 additions & 6 deletions App/StandardPageExtensions/SubscriptionOrder.PageExt.al
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ pageextension 50143 "Subscription Order" extends "Blanket Sales Order"

trigger OnAction()
var
FPFrSubscriptionManagement: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
begin
FPFrSubscriptionManagement.CalculateQuantityToShipYN(Rec);
SubscriptionManagement.CalculateQuantityToShipYN(Rec);
end;
}
action(MakeOrders)
Expand All @@ -34,9 +34,9 @@ pageextension 50143 "Subscription Order" extends "Blanket Sales Order"

trigger OnAction()
var
FPFrSubscriptionManagement: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
begin
FPFrSubscriptionManagement.MakeOrderYN(Rec);
SubscriptionManagement.MakeOrderYN(Rec);
end;
}
action("Calculate Next Subscription Period")
Expand All @@ -48,9 +48,9 @@ pageextension 50143 "Subscription Order" extends "Blanket Sales Order"

trigger OnAction()
var
FPFrSubscriptionManagement: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
begin
FPFrSubscriptionManagement.CalculateNextSubscriptionPeriodYN(Rec);
SubscriptionManagement.CalculateNextSubscriptionPeriodYN(Rec);
end;
}
}
Expand Down
33 changes: 18 additions & 15 deletions Tests/TestSubscriptionApp.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ codeunit 50144 "Test Subscription App"
var
StandardLibrary: Codeunit "Standard Library";
Assert: Codeunit Assert;
FPFrEventSubscribers: Codeunit "Event Subscribers";
EventSubscribers: Codeunit "Event Subscribers";



Expand All @@ -23,17 +23,17 @@ codeunit 50144 "Test Subscription App"
[Test]
procedure TestXMLFormatEnum()
var
FPFrSubscriptionEnum: Enum "Subscription Enum";
SubscriptionEnum: Enum "Subscription Enum";

begin
// [SCENARIO #001] Formating Enum
// [GIVEN] a new Enum
// [WHEN] formating
// [THEN] correct XML string

Assert.AreEqual('0', StandardLibrary.XMLFormat(FPFrSubscriptionEnum::" "), '');
Assert.AreEqual('1', StandardLibrary.XMLFormat(FPFrSubscriptionEnum::Recurring), '');
Assert.AreEqual('2', StandardLibrary.XMLFormat(FPFrSubscriptionEnum::Stop), '');
Assert.AreEqual('0', StandardLibrary.XMLFormat(SubscriptionEnum::" "), '');
Assert.AreEqual('1', StandardLibrary.XMLFormat(SubscriptionEnum::Recurring), '');
Assert.AreEqual('2', StandardLibrary.XMLFormat(SubscriptionEnum::Stop), '');
end;


Expand All @@ -47,7 +47,7 @@ codeunit 50144 "Test Subscription App"
SalesHeader: Record "Sales Header";
SalesLine1: Record "Sales Line";
SalesLine2: Record "Sales Line";
FPFrSubscriptionMgt: Codeunit "Subscription Management";
SubscriptionManagement: Codeunit "Subscription Management";
DateExpression: DateFormula;
ThisDay: Date;
LineNumber: Integer;
Expand All @@ -62,7 +62,7 @@ codeunit 50144 "Test Subscription App"
// [THEN] correct XML string

DebuggingMode := true;
BindSubscription(FPFrEventSubscribers);
BindSubscription(EventSubscribers);
ThisDay := DMY2Date(1, 1, 2024);
WorkDate(ThisDay);

Expand Down Expand Up @@ -104,7 +104,7 @@ codeunit 50144 "Test Subscription App"
SalesLine1.Init();
SalesLine1.Validate("Document Type", SalesHeader."Document Type");
SalesLine1.Validate("Document No.", SalesHeader."No.");
LineNumber := FPFrSubscriptionMgt.GetNextLineNumber(SalesHeader);
LineNumber := SubscriptionManagement.GetNextLineNumber(SalesHeader);
SalesLine1.Validate("Line No.", LineNumber);
SalesLine1.Insert(true);
SalesLine1.Validate(Type, SalesLine1.Type::Item);
Expand All @@ -122,7 +122,7 @@ codeunit 50144 "Test Subscription App"
SalesLine2.Init();
SalesLine2.Validate("Document Type", SalesHeader."Document Type");
SalesLine2.Validate("Document No.", SalesHeader."No.");
LineNumber := FPFrSubscriptionMgt.GetNextLineNumber(SalesHeader);
LineNumber := SubscriptionManagement.GetNextLineNumber(SalesHeader);
SalesLine2.Validate("Line No.", LineNumber);
SalesLine2.Insert(true);
SalesLine2.Validate(Type, SalesLine2.Type::Item);
Expand Down Expand Up @@ -150,21 +150,21 @@ codeunit 50144 "Test Subscription App"
BlanketOrderStatus := SalesHeaderStatus(SalesHeader);

for Counter := 1 to 10 do begin
FPFrSubscriptionMgt.CalculateQuantityToShipYN(SalesHeader);
SubscriptionManagement.CalculateQuantityToShipYN(SalesHeader);
BlanketOrderStatus := SalesHeaderStatus(SalesHeader);

FPFrSubscriptionMgt.MakeOrderYN(SalesHeader);
SubscriptionManagement.MakeOrderYN(SalesHeader);
SimulatePosting(SalesHeader);
BlanketOrderStatus := SalesHeaderStatus(SalesHeader);

FPFrSubscriptionMgt.CalculateNextSubscriptionPeriodYN(SalesHeader);
SubscriptionManagement.CalculateNextSubscriptionPeriodYN(SalesHeader);
BlanketOrderStatus := SalesHeaderStatus(SalesHeader);

ThisDay := CalcDate('<1D>', ThisDay);
WorkDate(ThisDay);
end;

UnbindSubscription(FPFrEventSubscribers);
UnbindSubscription(EventSubscribers);
end;

procedure SimulatePosting(SalesHeader: Record "Sales Header")
Expand All @@ -187,21 +187,24 @@ codeunit 50144 "Test Subscription App"
var
SalesLine: Record "Sales Line";
String: Text;
StatusTxt: Label 'Line %1, Date %2, Qty %3, To Ship %4, To inv %5, Shipped %6, Invoiced %7',
Comment = '%1 = Line No., %2 = Date, %3 = Quantity, %4 = Qty. to Ship, %5 = Qty. to Invoice, %6 = Quantity Shipped, %7 = Quantity Invoiced)';
begin
// String := StrSubstNo('%1 %2 %3\', Format(SalesHeader."Document Type"), SalesHeader."No.", SalesHeader."Document Date");
SalesLine.SetRange("Document Type", SalesHeader."Document Type");
SalesLine.SetRange("Document No.", SalesHeader."No.");
if SalesLine.FindSet() then
repeat
String := String +
StrSubstNo('Line %1, Date %2, Qty %3, To Ship %4, To inv %5, Shipped %6, Invoiced %7\',
StrSubstNo(StatusTxt,
SalesLine."Line No.",
Format(SalesLine."Shipment Date", 0, 9),
SalesLine.Quantity,
SalesLine."Qty. to Ship",
SalesLine."Qty. to Invoice",
SalesLine."Quantity Shipped",
SalesLine."Quantity Invoiced");
SalesLine."Quantity Invoiced") +
'\';
until SalesLine.Next() = 0;
exit(String);
end;
Expand Down

0 comments on commit 68b95b0

Please sign in to comment.