Proces szkoleń
This commit is contained in:
parent
cca6219870
commit
4c2c56f0dc
@ -706,19 +706,24 @@ class WorkflowEngine {
|
||||
private function checkTransitionCondition(array $transition, array $instanceData): bool
|
||||
{
|
||||
if (!isset($transition['condition'])) {
|
||||
// A transition without a condition is not automatic, but it is valid to pass through.
|
||||
// The calling context (findAutomaticTransition) will decide if this is an error.
|
||||
return true;
|
||||
}
|
||||
|
||||
$condition = $transition['condition'];
|
||||
$data = isset($instanceData['data_json']) ? json_decode($instanceData['data_json'], true) : [];
|
||||
|
||||
if (isset($condition['type']) && $condition['type'] === 'all_true') {
|
||||
if (!isset($condition['fields']) || !is_array($condition['fields'])) return false;
|
||||
foreach ($condition['fields'] as $f) {
|
||||
if (empty($data[$f]) || $data[$f] == '0' || $data[$f] == False) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$field = $condition['field'] ?? null;
|
||||
$expectedValue = $condition['value'] ?? null;
|
||||
|
||||
if ($field === null || $expectedValue === null) {
|
||||
// Malformed condition
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -57,12 +57,12 @@ $instance = $engine->getInstanceByDefId($person_id, $process_definition_id);
|
||||
$definition = $process['definition_json'] ? json_decode($process['definition_json'], true) : null;
|
||||
$isChecklist = ($definition && isset($definition['type']) && $definition['type'] === 'checklist');
|
||||
$events = $engine->getEvents($instanceId);
|
||||
$instanceData = $instance['data_json'] ? json_decode($instance['data_json'], true) : [];
|
||||
?>
|
||||
|
||||
<?php if ($isChecklist): ?>
|
||||
<?php
|
||||
$tasks = $definition['tasks'] ?? [];
|
||||
$instanceData = $instance['data_json'] ? json_decode($instance['data_json'], true) : [];
|
||||
?>
|
||||
<div class="checklist-modal-container" data-instance-id="<?= $instanceId ?>">
|
||||
<h5>Zadania do wykonania</h5>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user