Transitions
In invoiceR, a document passes through a series of process steps (nodes) connected by routes. A transition is program logic that is applied to the document when it moves along a specific route. A route can have several transitions, and the same transition can be used on several routes.
Setting up a transition
Section titled “Setting up a transition”Transitions are registered in the conf.Transitions table:
| Column | Content |
|---|---|
Id | new GUID |
TenantId | usually 1 |
ClassIdentifier | full class name of the transition |
Description | short description |
RouteId | Id of the route from conf.Routes on which the transition should run |
Order | order when a route has several transitions (ascending) |
INSERT INTO conf.Transitions (Id, TenantId, ClassIdentifier, Description, RouteId, [Order])VALUES (NEWID(), 1, N'enio.InvoiceR.Engine.DefaultPlugin.Transitions.FourEyeForcerTransition', N'Enforce four-eyes principle', N'<Id of the route from accounting to approval>', 1);Enforcing the four-eyes principle (FourEyeForcerTransition)
Section titled “Enforcing the four-eyes principle (FourEyeForcerTransition)”Class: enio.InvoiceR.Engine.DefaultPlugin.Transitions.FourEyeForcerTransition
This transition typically runs after accounting and before approval. For each accounting line, it checks whether at least a certain number of different users or roles have to approve. If not, it creates an additional approval request for the line. The effect is the same as if someone had requested a manual approval during accounting.
The transition reads these settings (section WorkflowManagement:FourEyeForcer in appsettings.json
or per tenant in the database, see Overview):
| Setting | Meaning |
|---|---|
MinimumOfUsersForVisaRequest | minimum number of approvers per line, usually 2. Existing approval requests count. Required. |
DefaultUserForEnforcing4EyePrinciple | Id of the user who receives the additional approval |
DefaultRoleFourEnforcing4EyePrinciple | Id of the role that receives the additional approval |
Priority | priority of the new approval request. This controls whether it is obtained before, together with or after the approvals from the rules. |
CostcenterForCheckingThe4EyePrinciple | optional: number of a cost center. The transition then only checks lines with this cost center. Empty means all lines. |
Enter at least one user or role.
{ "WorkflowManagement": { "FourEyeForcer": { "MinimumOfUsersForVisaRequest": "2", "DefaultRoleFourEnforcing4EyePrinciple": "12", "Priority": "10" } }}Automatic approval for the accountant
Section titled “Automatic approval for the accountant”These transitions run after accounting is complete and automatically give the accountant an approval. There are two variants:
SimpleAccountantVisumTransition: only gives the approval if the accountant would have to approve according to the approval rules anyway. If the accountant does not appear in the rules, nothing changes.AccountantVisumTransition: creates an approval request for the accountant on every accounting line and grants it immediately (unless a request for them already exists).
Both classes are in the namespace enio.InvoiceR.Engine.DefaultPlugin.Transitions. The automatically
granted approval appears in the document history.
INSERT INTO conf.Transitions (Id, TenantId, ClassIdentifier, Description, RouteId, [Order])VALUES (NEWID(), 1, N'enio.InvoiceR.Engine.DefaultPlugin.Transitions.SimpleAccountantVisumTransition', N'Automatic approval for accountant', N'<Id of the route after accounting>', 1);