=1024 && $iformat($format); } catch(Throwable $e){ return '—'; } } $praticien_id = (int)($_SESSION['reference_id'] ?? 0); $dossier_id = (int)($_GET['dossier_id'] ?? 0); if ($praticien_id<=0 || $dossier_id<=0) { header('Location: index.php'); exit; } /* ----- Dossier + Client (vérif propriétaire) ----- */ $st = $pdo->prepare(" SELECT d.id, d.praticien_id, d.client_id, d.tags, c.nom, c.prenom, c.email, c.telephone, c.adresse, c.ville, c.code_postal, c.date_naissance FROM client_dossiers d JOIN client c ON c.id = d.client_id WHERE d.id = :d AND d.praticien_id = :p AND d.archived_at IS NULL LIMIT 1 "); $st->execute([':d'=>$dossier_id, ':p'=>$praticien_id]); $dos = $st->fetch(PDO::FETCH_ASSOC); if(!$dos){ header('Location: index.php'); exit; } /* ----- Historique RDV ----- */ $stR = $pdo->prepare(" SELECT date_rdv, duree_minutes, lieu, statut FROM rendez_vous WHERE praticien_id = :p AND client_id = :c AND (statut = 'terminé' OR statut = 'confirmé') ORDER BY date_rdv DESC LIMIT 100 "); $stR->execute([':p'=>$praticien_id, ':c'=>$dos['client_id']]); $rdvs = $stR->fetchAll(PDO::FETCH_ASSOC); /* ----- Notes + fichiers ----- */ $stN = $pdo->prepare(" SELECT s.* FROM client_suivi s WHERE s.dossier_id = :d ORDER BY s.date_rdv DESC, s.id DESC "); $stN->execute([':d'=>$dossier_id]); $notes = $stN->fetchAll(PDO::FETCH_ASSOC); $filesByEntry = []; if ($notes) { $ids = array_column($notes, 'id'); $ph = implode(',', array_fill(0, count($ids), '?')); $stF = $pdo->prepare(" SELECT f.id, f.entry_id, f.path, f.mime, f.size_bytes FROM client_suivi_files f WHERE f.entry_id IN ($ph) ORDER BY f.id ASC "); $stF->execute($ids); while($f = $stF->fetch(PDO::FETCH_ASSOC)){ $filesByEntry[(int)$f['entry_id']][] = $f; } } /* ----- CSRF pour actions (si besoin) ----- */ if (empty($_SESSION['cl_csrf'])) $_SESSION['cl_csrf'] = bin2hex(random_bytes(32)); $CSRF = $_SESSION['cl_csrf']; ?>

· : · : min
:
📎


min