query("SELECT * FROM outlets ORDER BY name")->fetchAll(PDO::FETCH_ASSOC); } else { $stmt = $pdo->prepare(" SELECT o.* FROM outlets o JOIN user_outlets uo ON o.id = uo.outlet_id WHERE uo.user_id = ? ORDER BY o.name "); $stmt->execute([$currentUser['id']]); $outlets = $stmt->fetchAll(PDO::FETCH_ASSOC); } $current_outlet_id = isset($_GET['outlet_id']) ? (int)$_GET['outlet_id'] : (count($outlets) > 0 ? (int)$outlets[0]['id'] : 1); // Security check: ensure user has access to this outlet if (!has_permission('all')) { $has_access = false; foreach ($outlets as $o) { if ($o['id'] == $current_outlet_id) { $has_access = true; break; } } if (!$has_access && count($outlets) > 0) { $current_outlet_id = (int)$outlets[0]['id']; } } ?> Kitchen Display System

Kitchen Display

Loading orders...