query("SELECT name, role FROM pf_people ORDER BY id ASC"); $familyParents = []; $familyKids = []; while ($row = $stmtPeople->fetch(PDO::FETCH_ASSOC)) { $role = strtolower(trim($row['role'] ?? '')); if ($role === 'parent') { $familyParents[] = $row['name']; } elseif ($role === 'nounou' || $role === 'helper') { // On ignore la nounou dans l'épargne continue; } else { $familyKids[] = $row['name']; } } // Sécurité anti-page blanche si la BDD est mal configurée if (empty($familyParents)) $familyParents = ['Parent 1', 'Parent 2']; $requestedOwner = $_GET['owner'] ?? (!empty($familyKids) ? 'KIDS' : ($familyParents[0] ?? 'KIDS')); $ownersToDisplay = ($requestedOwner === 'KIDS') ? $familyKids : [$requestedOwner]; // --- RÉCUPÉRATION CONFIGURATION DES MOIS --- $cycleConfigs = []; $stmtNotes = $pdo->query("SELECT reference_id, content FROM pf_notes WHERE note_type = 'month_config'"); while ($row = $stmtNotes->fetch(PDO::FETCH_ASSOC)) { $parts = explode('-', $row['reference_id']); if (count($parts) == 2) { $mKey = $parts[1] . '-' . $parts[0] . '-01'; $cycleConfigs[$mKey] = json_decode($row['content'], true); } } function getMonthName($dateString) { $m = date('m', strtotime($dateString)); $y = date('Y', strtotime($dateString)); return tr('month_' . $m) . ' ' . $y; } ?>
$currentOwner): $stmt = $pdo->prepare("SELECT month_date, category, amount FROM pf_savings WHERE owner = ? ORDER BY month_date DESC"); $stmt->execute([$currentOwner]); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $data = []; $months = []; $allCategories = []; foreach ($rows as $row) { $m = $row['month_date']; $cat = $row['category']; $val = $row['amount']; $data[$m][$cat] = $val; if (!in_array($m, $months)) $months[] = $m; if ($cat !== 'TOTAL_BANQUE' && !in_array($cat, $allCategories)) $allCategories[] = $cat; } $months = array_slice($months, 0, 7); sort($allCategories); $ownerTextClass = 'txt-global'; // 🔄 CORRECTION ICI : Création d'un nom "safe" sans espace pour les classes CSS $safeOwnerCls = htmlspecialchars(str_replace(' ', '_', $currentOwner), ENT_QUOTES); ?>

" . sprintf(tr('bud_sav_from_date'), $cStart) . ""; } ?>

0 €