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') { // On ignore la nounou dans l'épargne continue; } else { // Fallback : Si c'est 'enfant', 'user', ou vide, ça va dans l'onglet Enfants $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'] ?? ($familyParents[0] ?? 'Nens'); $ownersToDisplay = ($requestedOwner === 'Nens') ? $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; } ?>
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); // Définition de la classe couleur selon le propriétaire $ownerTextClass = 'txt-global'; ?>

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

0 €