'That device, or its asset, is no longer in ITFlow.']); exit; } $client_id = intval($row['asset_client_id']); enforceClientAccess(); if (!isset(rmmDeviceActions($row)['script'])) { echo json_encode(['error' => rmmActionHost($row) . ' can\'t have scripts run from ITFlow now.']); exit; } $name = rmmProviderName($row); $host = rmmActionHost($row); $answer = rmmDeviceScripts($row); $scripts = $answer['scripts']; // The tickets it can go on - the one it was opened from first $ticket_id = intval($_GET['ticket_id'] ?? 0); $tickets = rmmActionTickets(intval($row['rmm_device_asset_id']), $client_id, $ticket_id); if (!isset($tickets[$ticket_id])) { $ticket_id = 0; } // Grouped as the RMM has them - its favorites, then each category $groups = []; foreach ($scripts as $script) { $groups[$script['favorite'] ? 'Favorites' : ($script['category'] !== '' ? $script['category'] : 'Other')][] = $script; } $first = $scripts[0] ?? null; ob_start(); ?>