From a9be1561e18e386a701a674fbeec73820c55a314 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 12 Apr 2024 10:34:58 +0200 Subject: [PATCH] new: [workflowMouldes:stop-execution] Added message paramter to allow user to provide a reason why the execution was stopped --- .../action/Module_stop_execution.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Model/WorkflowModules/action/Module_stop_execution.php b/app/Model/WorkflowModules/action/Module_stop_execution.php index 5266a1557..b02bce689 100644 --- a/app/Model/WorkflowModules/action/Module_stop_execution.php +++ b/app/Model/WorkflowModules/action/Module_stop_execution.php @@ -6,6 +6,7 @@ class Module_stop_execution extends WorkflowBaseActionModule public $blocking = true; public $id = 'stop-execution'; public $name = 'Stop execution'; + public $version = '0.2'; public $description = 'Essentially stops the execution for blocking workflows. Do nothing for non-blocking ones'; public $icon = 'ban'; public $inputs = 1; @@ -15,12 +16,25 @@ class Module_stop_execution extends WorkflowBaseActionModule public function __construct() { parent::__construct(); + + $this->params = [ + [ + 'id' => 'message', + 'label' => 'Stop message', + 'type' => 'input', + 'default' => __('Execution stopped'), + 'placeholder' => __('Execution stopped'), + 'jinja_supported' => true, + ], + ]; } public function exec(array $node, WorkflowRoamingData $roamingData, array &$errors = []): bool { parent::exec($node, $roamingData, $errors); - $errors[] = __('Execution stopped'); + $rData = $roamingData->getData(); + $params = $this->getParamsWithValues($node, $rData); + $errors[] = empty($params['message']['value']) ? $params['message']['default'] : $params['message']['value']; return false; } }