'Unauthorized']); exit; } $person_id = $_GET['person_id'] ?? null; $process_definition_id = $_GET['process_id'] ?? null; $process_code = $_GET['process_code'] ?? null; $pdo = db(); if (!$process_definition_id && $process_code) { $stmt = $pdo->prepare("SELECT id FROM process_definitions WHERE code = ? AND is_latest = 1 LIMIT 1"); $stmt->execute([$process_code]); $process_definition_id = $stmt->fetchColumn(); } if (!$person_id || !$process_definition_id) { http_response_code(400); echo json_encode(['error' => 'Missing person_id or process_id']); exit; } $userId = $_SESSION['user_id']; $engine = new WorkflowEngine(); // Fetch Person and Process Definition details first $stmt_person = $pdo->prepare("SELECT first_name, last_name FROM people WHERE id = ?"); $stmt_person->execute([$person_id]); $person = $stmt_person->fetch(); $stmt_process = $pdo->prepare("SELECT * FROM process_definitions WHERE id = ?"); $stmt_process->execute([$process_definition_id]); $process = $stmt_process->fetch(); if (!$person || !$process) { http_response_code(404); echo "
Could not find person or process.
"; exit; } // Try to find an existing instance $instance = $engine->getInstanceByDefId($person_id, $process_definition_id); ?>No actions available.
Brak zdarzeń.
Outcome: = htmlspecialchars($outcomeLabel) ?>
"= nl2br(htmlspecialchars($data['note'])) ?>"
Next follow-up: = date('d.m.Y, H:i', strtotime($data['next_contact_date'])) ?>
= htmlspecialchars(ucfirst(str_replace('_', ' ', $event['event_type']))) ?> ' . htmlspecialchars($message) . ''; } ?> By = htmlspecialchars($event['first_name'] . ' ' . $event['last_name']) ?> on = date('d.m.Y, H:i', strtotime($event['created_at'])) ?>This process has not been started for this person.
This person is not eligible to start this process.