Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-03-09 23:07:05 +01:00
parent 3361cffb14
commit 2e9db78c6e
18 changed files with 2855 additions and 69 deletions

View File

@@ -1,72 +1,39 @@
# Workflow Definitions
# Workflow Documentation
This directory contains workflow definitions in JSON format that can be imported into EspoCRM using the workflow manager script.
Dokumentation für EspoCRM Workflow-Management.
## File Format
## Workflow-Format & Management
### Simple Workflow
```json
{
"type": "simple",
"name": "workflow-name",
"entity_type": "EntityName",
"trigger_type": "afterRecordSaved",
"is_active": true,
"description": "Description of what this workflow does",
"category": "Category Name",
"conditions_all": [],
"conditions_any": [],
"conditions_formula": null,
"actions": []
}
```
Siehe: `custom/docs/workflows/README.md` für vollständige Workflow-Dokumentation inkl.:
- Simple Workflow JSON-Format
- BPM Flowchart Format
- Trigger Types (afterRecordSaved, afterRecordCreated, scheduled, manual)
- Action Types (sendEmail, createEntity, updateEntity, etc.)
- Condition Types
- Import/Export mit workflow_manager.php
**Trigger Types:**
- `afterRecordSaved` - After record is created or updated
- `afterRecordCreated` - Only after record is created
- `scheduled` - Runs on a schedule
- `manual` - Manually triggered
## Workflow-Befehle
**Condition Types:**
- `equals`, `notEquals`, `greaterThan`, `lessThan`, `contains`, `notContains`, `isEmpty`, `isNotEmpty`, `isTrue`, `isFalse`, `wasEqual`, `wasNotEqual`, `changed`, `notChanged`
**Action Types:**
- `sendEmail` - Send email to recipient
- `createEntity` - Create a new record
- `updateEntity` - Update current record
- `relateTo` - Link to another record
- `unrelateFrom` - Unlink from record
- `applyAssignmentRule` - Apply assignment rules
- `createNotification` - Create notification
### BPM Flowchart
```json
{
"type": "bpm",
"name": "flowchart-name",
"target_type": "EntityName",
"is_active": true,
"description": "Description",
"data": {
"list": []
},
"elements_data_hash": {},
"event_start_all_id_list": []
}
```
## Usage
Import a workflow:
```bash
docker exec espocrm php /var/www/html/custom/scripts/workflow_manager.php import /var/www/html/custom/workflows/your-workflow.json
# Alle Workflows auflisten
php custom/scripts/workflow_manager.php list
# Workflow importieren
php custom/scripts/workflow_manager.php import custom/workflows/my-workflow.json
# Alle Workflows exportieren
php custom/scripts/workflow_manager.php export
# Workflow löschen
php custom/scripts/workflow_manager.php delete workflow-name
```
Export a workflow:
```bash
docker exec espocrm php /var/www/html/custom/scripts/workflow_manager.php export <workflow-id> /var/www/html/custom/workflows/exported.json
```
## Workflow-Dateien
## Examples
Workflow-Definitionen werden als JSON-Dateien in diesem Verzeichnis gespeichert und können mit dem workflow_manager.php Tool importiert werden.
- `vmh-erstberatung-abschliessen.json` - Sends email and sets status when consultation is completed
**Datei-Naming:** `{workflow-name}.json` (Kleinbuchstaben, Bindestriche)
---
Für Details siehe: **custom/docs/workflows/README.md**