From d03f6bad80b5adeae8fa7f5f4587e4f0de79d8a8 Mon Sep 17 00:00:00 2001 From: "fefe.clochette" Date: Thu, 2 Apr 2026 16:04:53 +0200 Subject: [PATCH] fix button --- modules/holidays/includes/api/save_checkpoint.php | 10 ++++------ modules/holidays/views/detail.php | 3 +-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/holidays/includes/api/save_checkpoint.php b/modules/holidays/includes/api/save_checkpoint.php index 12248d8..89dcea0 100644 --- a/modules/holidays/includes/api/save_checkpoint.php +++ b/modules/holidays/includes/api/save_checkpoint.php @@ -57,7 +57,8 @@ if ($holiday_id > 0 && !empty($location_name)) { $step_start = !empty($_POST['step_start_date']) ? $_POST['step_start_date'] : null; $step_end = !empty($_POST['step_end_date']) ? $_POST['step_end_date'] : null; - // 3. INSERTION DES LIGNES (Avec Mémoire de la Durée et du Planning) + // 3. INSERTION DES LIGNES + // Il doit y avoir EXACTEMENT 15 colonnes et 15 points d'interrogation (?) $stmt = $pdo->prepare("INSERT INTO pf_holidays_items (holiday_id, category, name, amount, is_paid, location_name, lat, lng, sort_order, notes, item_date, item_time, step_start_date, step_end_date, duration) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $validItemsCount = 0; @@ -76,21 +77,18 @@ if ($holiday_id > 0 && !empty($location_name)) { $time = !empty($_POST['items']['time'][$i]) ? $_POST['items']['time'][$i] : null; $dur = !empty($_POST['items']['duration'][$i]) ? (int)$_POST['items']['duration'][$i] : 1; + // Les 15 variables passées au tableau doivent correspondre aux 15 points d'interrogation $stmt->execute([$holiday_id, $cat, $name ?: 'Dépense', $amount, $paid, $location_name, $lat, $lng, $target_order, $note, $date, $time, $step_start, $step_end, $dur]); $validItemsCount++; } } } + // Si l'étape est vide, on enregistre quand même ses dates if ($validItemsCount === 0) { $stmt->execute([$holiday_id, 'activity', 'PF_TECHNICAL_POINT', 0, 1, $location_name, $lat, $lng, $target_order, '', null, null, $step_start, $step_end, 1]); } - // Point technique si aucune dépense n'est saisie (pour garder la trace de l'étape et de ses dates) - if ($validItemsCount === 0) { - $stmt->execute([$holiday_id, 'activity', 'PF_TECHNICAL_POINT', 0, 1, $location_name, $lat, $lng, $target_order, '', null, null, $step_start, $step_end]); - } - // 4. GESTION DES FAVORIS if (isset($_POST['save_favorite']) && $_POST['save_favorite'] == '1') { $stmtFav = $pdo->query("SELECT content FROM pf_notes WHERE note_type = 'holiday_favorites'"); diff --git a/modules/holidays/views/detail.php b/modules/holidays/views/detail.php index 949ab5c..99d5e87 100644 --- a/modules/holidays/views/detail.php +++ b/modules/holidays/views/detail.php @@ -78,8 +78,7 @@ $pctSaved = $cost > 0 ? min(100 - $pctPaid, ($saved / $cost) * 100) : 0;

- - +