order by holidays

This commit is contained in:
2026-03-28 18:20:21 +01:00
parent 1f8b28cf8e
commit 28b8a6d49a
+6 -2
View File
@@ -1,6 +1,7 @@
<?php <?php
// modules/holidays/index.php // modules/holidays/index.php
// 1. Récupération des voyages + Calculs (Coût Total ET Montant déjà financé)
// 1. Récupération des voyages + Calculs (Coût Total ET Montant déjà financé) // 1. Récupération des voyages + Calculs (Coût Total ET Montant déjà financé)
$sql = " $sql = "
SELECT h.*, SELECT h.*,
@@ -14,8 +15,11 @@ $sql = "
COALESCE((SELECT SUM(amount) FROM pf_savings WHERE holiday_id = h.id), 0) COALESCE((SELECT SUM(amount) FROM pf_savings WHERE holiday_id = h.id), 0)
) as total_funded ) as total_funded
FROM pf_holidays h FROM pf_holidays h
ORDER BY FIELD(status, 'booked', 'planned', 'draft', 'passed', 'archived'), ORDER BY
start_date ASC -- COALESCE permet de rejeter les voyages sans date tout à la fin de la liste (ex: l'an 2999)
COALESCE(start_date, '2999-12-31') ASC,
FIELD(status, 'booked', 'planned', 'draft', 'passed', 'archived')
"; ";
$holidays = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC); $holidays = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);