Skip to content

Commit 446031d

Browse files
author
Jani Giannoudis
committed
Fix No-Code action attributes
PayrollFunction.Action.cs: add missing ActionParameter for Contains; fix HasLookupValue second overload (rangeValue param, StringType on field); fix YearDiff description WageTypeFunction.Action.cs: fix GetWageTypeValueByNumber param desc PayrunFunction.Action.cs: move StringType out of description string in SetPayrunResultValue CaseRelationBuildFunction.Action.cs: fix GetSourceFieldStart / GetSourceFieldEnd description ("target" → "source case")
1 parent bc31a75 commit 446031d

7 files changed

Lines changed: 98 additions & 6 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<AssemblyName>ActionDocGenerator</AssemblyName>
6+
<RootNamespace>ActionDocGenerator</RootNamespace>
7+
<Description>PayrollEngine No-Code Action Documentation Generator</Description>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\Client.Scripting\PayrollEngine.Client.Scripting.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

ActionDocGenerator/Program.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.IO;
3+
using System.Text.Json;
4+
using System.Text.Json.Serialization;
5+
using PayrollEngine.Client.Scripting;
6+
7+
// args[0] = path to PayrollEngine.Client.Scripting.dll
8+
if (args.Length < 1)
9+
{
10+
Console.Error.WriteLine("Usage: ActionDocGenerator <scripting-dll-path>");
11+
return 1;
12+
}
13+
14+
var dllPath = Path.GetFullPath(args[0]);
15+
if (!File.Exists(dllPath))
16+
{
17+
Console.Error.WriteLine($"File not found: {dllPath}");
18+
return 1;
19+
}
20+
21+
try
22+
{
23+
Console.Error.WriteLine($"Loading: {Path.GetFileName(dllPath)}");
24+
var (_, actions) = ActionReflector.LoadFrom(dllPath);
25+
Console.Error.WriteLine($"Actions: {actions.Count}");
26+
27+
var options = new JsonSerializerOptions
28+
{
29+
WriteIndented = false,
30+
Converters = { new JsonStringEnumConverter() }
31+
};
32+
Console.WriteLine(JsonSerializer.Serialize(actions, options));
33+
return 0;
34+
}
35+
catch (Exception ex)
36+
{
37+
Console.Error.WriteLine($"Error: {ex.GetType().Name}: {ex.Message}");
38+
return 1;
39+
}

Client.Scripting/Function/CaseRelationBuildFunction.Action.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ public ActionValue GetSourceFieldValue(string field) =>
1818

1919
/// <summary>Get the case relation source field start date</summary>
2020
/// <param name="field">The case field on the source case</param>
21-
[ActionParameter("field", "The case field on the target case", [StringType])]
21+
[ActionParameter("field", "The case field on the source case", [StringType])]
2222
[CaseRelationBuildAction("GetSourceFieldStart", "Get the case relation source field start date", "RelationField")]
2323
public ActionValue GetSourceFieldStart(string field) =>
2424
new(GetSourceStart(field));
2525

2626
/// <summary>Get the case relation source field end date</summary>
2727
/// <param name="field">The case field on the source case</param>
28-
[ActionParameter("field", "The case field on the target case", [StringType])]
28+
[ActionParameter("field", "The case field on the source case", [StringType])]
2929
[CaseRelationBuildAction("GetSourceFieldEnd", "Get the case relation source field end date", "RelationField")]
3030
public ActionValue GetSourceFieldEnd(string field) =>
3131
new(GetSourceEnd(field));

Client.Scripting/Function/PayrollFunction.Action.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public bool HasLookupValue(string lookup, ActionValue keyOrRangeValue, string fi
4747
/// <summary>Test for lookup value by key and range value</summary>
4848
[ActionParameter("lookup", "The lookup name", [StringType])]
4949
[ActionParameter("key", "The lookup key", [StringType])]
50-
[ActionParameter("field", "The JSON value field name (optional)")]
50+
[ActionParameter("rangeValue", "The range value", [NumericType])]
51+
[ActionParameter("field", "The JSON value field name (optional)", [StringType])]
5152
[PayrollAction("HasLookupValue", "Test for lookup value by key and range value", "Lookup")]
5253
public bool HasLookupValue(string lookup, ActionValue key, ActionValue rangeValue, string field = null) =>
5354
GetLookupValue(lookup, key, rangeValue, field).HasValue;
@@ -475,6 +476,7 @@ public ActionValue Concat(params ActionValue[] values)
475476
/// <param name="source">Object to test</param>
476477
/// <param name="values">Available values</param>
477478
/// <returns>True, if source is listed in tests</returns>
479+
[ActionParameter("source", "The value to test")]
478480
[ActionParameter("values", "Value collection", [NumericType, DateType, StringType])]
479481
[PayrollAction("Contains", "Test if value is from a specific value domain", "String")]
480482
public bool Contains(ActionValue source, params ActionValue[] values)
@@ -599,7 +601,7 @@ public ActionValue SameDay(ActionValue left, ActionValue right)
599601
/// <returns>The year (int) od dates, otherwise none</returns>
600602
[ActionParameter("start", "The start date", [DateType])]
601603
[ActionParameter("end", "The end date", [DateType])]
602-
[PayrollAction("YearDiff", "Test for same date year", "Date")]
604+
[PayrollAction("YearDiff", "Get years between two dates", "Date")]
603605
public ActionValue YearDiff(ActionValue start, ActionValue end)
604606
{
605607
if (start != null && end != null &&

Client.Scripting/Function/PayrunFunction.Action.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public ActionValue GetPayrunResultValue(string name) =>
8484
/// <summary>Set payrun result value</summary>
8585
[ActionParameter("name", "The result name", [StringType])]
8686
[ActionParameter("value", "The value to set")]
87-
[ActionParameter("type", "The value type (default: Money), [StringType]")]
87+
[ActionParameter("type", "The value type (default: Money)", [StringType])]
8888
[PayrunAction("SetPayrunResultValue", "Set payrun result value", "Payrun")]
8989
public void SetPayrunResultValue(string name, object value, string type = null)
9090
{

Client.Scripting/Function/WageTypeFunction.Action.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class WageTypeFunction
1010

1111
/// <summary>Get wage type value by number</summary>
1212
/// <param name="number">Wage type number</param>
13-
[ActionParameter("number", "Get wage type value by number", [DecimalType])]
13+
[ActionParameter("number", "The wage type number", [DecimalType])]
1414
[WageTypeAction("GetWageTypeValueByNumber", "Get wage type value", "WageType")]
1515
public ActionValue GetWageTypeValueByNumber(decimal number) =>
1616
GetWageType(number);

PayrollEngine.Client.Scripting.sln

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,56 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1515
.github\workflows\release.yml = .github\workflows\release.yml
1616
EndProjectSection
1717
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionDocGenerator", "ActionDocGenerator\ActionDocGenerator.csproj", "{24ECF776-EED1-43CF-8390-032EA9B11D49}"
19+
EndProject
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client.Scripting", "Client.Scripting", "{B2C75F6B-FD26-70A5-D7B5-BE42DEEF9C13}"
21+
EndProject
1822
Global
1923
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2024
Debug|Any CPU = Debug|Any CPU
25+
Debug|x64 = Debug|x64
26+
Debug|x86 = Debug|x86
2127
Release|Any CPU = Release|Any CPU
28+
Release|x64 = Release|x64
29+
Release|x86 = Release|x86
2230
EndGlobalSection
2331
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2432
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2533
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|x64.ActiveCfg = Debug|Any CPU
35+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|x64.Build.0 = Debug|Any CPU
36+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|x86.ActiveCfg = Debug|Any CPU
37+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Debug|x86.Build.0 = Debug|Any CPU
2638
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|Any CPU.ActiveCfg = Release|Any CPU
2739
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|x64.ActiveCfg = Release|Any CPU
41+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|x64.Build.0 = Release|Any CPU
42+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|x86.ActiveCfg = Release|Any CPU
43+
{4C720101-11E6-442C-B56E-5A8A3A25459B}.Release|x86.Build.0 = Release|Any CPU
2844
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2945
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|x64.ActiveCfg = Debug|Any CPU
47+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|x64.Build.0 = Debug|Any CPU
48+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|x86.ActiveCfg = Debug|Any CPU
49+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Debug|x86.Build.0 = Debug|Any CPU
3050
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
3151
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|x64.ActiveCfg = Release|Any CPU
53+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|x64.Build.0 = Release|Any CPU
54+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|x86.ActiveCfg = Release|Any CPU
55+
{99C026E8-6311-4153-8DC0-01E9CC93AE3F}.Release|x86.Build.0 = Release|Any CPU
56+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|x64.ActiveCfg = Debug|Any CPU
59+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|x64.Build.0 = Debug|Any CPU
60+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|x86.ActiveCfg = Debug|Any CPU
61+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Debug|x86.Build.0 = Debug|Any CPU
62+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|x64.ActiveCfg = Release|Any CPU
65+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|x64.Build.0 = Release|Any CPU
66+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|x86.ActiveCfg = Release|Any CPU
67+
{24ECF776-EED1-43CF-8390-032EA9B11D49}.Release|x86.Build.0 = Release|Any CPU
3268
EndGlobalSection
3369
GlobalSection(SolutionProperties) = preSolution
3470
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)