RMM Providers > a provider's clients (functions/rmm.php). Each of the RMM's clients * is linked to the ITFlow client its devices go to, or not linked yet - with the client of the * same name suggested. Linking brings that client's devices in straight away; after that, * every 15 minutes (cron/rmm_sync.php) or with Sync now. The handlers are admin/post/rmm.php. */ // Default Column Sortby Filter $sort = "rmm_client_name"; $order = "ASC"; require_once "includes/inc_all_admin.php"; $provider = rmmProviderRow($_GET['provider_id'] ?? 0); $kind = $provider ? rmmKind($provider) : null; if (!$provider || !$kind) { ?>
RMM Providers
['label' => 'All', 'icon' => 'fa-list', 'sql' => 'rmm_client_removed_at IS NULL', 'title' => "Every client $name has"], 'unlinked' => ['label' => 'Not linked', 'icon' => 'fa-unlink', 'sql' => 'rmm_client_removed_at IS NULL AND rmm_client_client_id = 0', 'title' => 'Their devices don\'t come in until they are linked'], 'linked' => ['label' => 'Linked', 'icon' => 'fa-link', 'sql' => 'rmm_client_removed_at IS NULL AND rmm_client_client_id > 0', 'title' => 'Their devices come in as assets'], 'removed' => ['label' => "Gone from $short", 'icon' => 'fa-ghost', 'sql' => 'rmm_client_removed_at IS NOT NULL', 'title' => "$name no longer has them"], ]; $show = isset($shows[$_GET['show'] ?? '']) ? (string) ($_GET['show'] ?? '') : ''; $view_counts = []; foreach ($shows as $key => $view) { $view_counts[$key] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM rmm_clients WHERE rmm_client_provider_id = $provider_id AND {$view['sql']}"))[0]); } $filter_url = function (array $change) { $get = array_merge($_GET, $change); unset($get['page']); $get = array_filter($get, function ($value) { return $value !== null && $value !== ''; }); return '?' . http_build_query($get); }; // Only these sort - an unknown column would take the page down $sortable_columns = [ 'rmm_client_name' => "rmm_client_name $order", 'rmm_client_devices' => "rmm_client_devices $order, rmm_client_name ASC", 'client_name' => "client_name IS NULL, client_name $order, rmm_client_name ASC", 'rmm_client_synced_at' => "rmm_client_synced_at IS NULL, rmm_client_synced_at $order, rmm_client_name ASC", ]; if (!isset($sortable_columns[$sort])) { $sort = 'rmm_client_name'; } $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS rmm_clients.*, client_name, client_abbreviation, client_archived_at, (SELECT COUNT(*) FROM rmm_devices WHERE rmm_device_rmm_client_id = rmm_clients.rmm_client_id AND rmm_device_removed_at IS NULL AND rmm_device_asset_id > 0) AS assets_in, (SELECT COUNT(*) FROM rmm_devices WHERE rmm_device_rmm_client_id = rmm_clients.rmm_client_id AND rmm_device_removed_at IS NULL AND rmm_device_asset_id = 0) AS assets_deleted, (SELECT COUNT(*) FROM rmm_devices WHERE rmm_device_rmm_client_id = rmm_clients.rmm_client_id AND rmm_device_removed_at IS NULL AND rmm_device_status = 'overdue') AS devices_overdue FROM rmm_clients LEFT JOIN clients ON client_id = rmm_client_client_id AND rmm_client_client_id > 0 WHERE rmm_client_provider_id = $provider_id AND {$shows[$show]['sql']} AND (rmm_client_name LIKE '%$q%' OR client_name LIKE '%$q%') ORDER BY {$sortable_columns[$sort]}, rmm_client_id ASC LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); // The ITFlow clients the suggestions name $suggested_names = []; if ($suggestions) { $suggested_sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_id IN (" . implode(', ', array_map('intval', $suggestions)) . ")"); while ($row = mysqli_fetch_assoc($suggested_sql)) { $suggested_names[intval($row['client_id'])] = $row['client_name']; } } $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $dashboard = rmmDashboardUrl($provider); $devices_in = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM rmm_devices WHERE rmm_device_provider_id = $provider_id AND rmm_device_removed_at IS NULL AND rmm_device_asset_id > 0"))[0]); ?>

· Clients Off

Not synced yet - link a client below and its devices come in straight away. Synced - The sync didn't work: device in ITFlow
Link each of 's clients to yours - its devices come in as assets.
">
Gone from
site · devices
in
asset overdue deleted
Archived
Its client was deleted -
Not linked Pick
"$short clients", 'icon' => $kind['icon'], 'title' => escapeHtml($show === 'unlinked' ? "Every $short client is linked" : "No $short clients yet"), 'text' => $show === 'unlinked' ? '' : escapeHtml($provider['rmm_provider_sync_at'] ? "$name has no clients this key can see." : "Sync now asks $name for its clients."), 'actions' => $usable && !$provider['rmm_provider_sync_at'] ? [['label' => 'Sync now', 'href' => "post.php?sync_rmm=$provider_id&csrf_token=$csrf", 'icon' => 'fa-sync-alt']] : [], 'filtered' => $q !== '', ]; ?>