fix button

This commit is contained in:
2026-04-02 16:04:53 +02:00
parent c2aa1e9f7b
commit d03f6bad80
2 changed files with 5 additions and 8 deletions
@@ -57,7 +57,8 @@ if ($holiday_id > 0 && !empty($location_name)) {
$step_start = !empty($_POST['step_start_date']) ? $_POST['step_start_date'] : null; $step_start = !empty($_POST['step_start_date']) ? $_POST['step_start_date'] : null;
$step_end = !empty($_POST['step_end_date']) ? $_POST['step_end_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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $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; $validItemsCount = 0;
@@ -76,21 +77,18 @@ if ($holiday_id > 0 && !empty($location_name)) {
$time = !empty($_POST['items']['time'][$i]) ? $_POST['items']['time'][$i] : null; $time = !empty($_POST['items']['time'][$i]) ? $_POST['items']['time'][$i] : null;
$dur = !empty($_POST['items']['duration'][$i]) ? (int)$_POST['items']['duration'][$i] : 1; $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]); $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++; $validItemsCount++;
} }
} }
} }
// Si l'étape est vide, on enregistre quand même ses dates
if ($validItemsCount === 0) { 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]); $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 // 4. GESTION DES FAVORIS
if (isset($_POST['save_favorite']) && $_POST['save_favorite'] == '1') { if (isset($_POST['save_favorite']) && $_POST['save_favorite'] == '1') {
$stmtFav = $pdo->query("SELECT content FROM pf_notes WHERE note_type = 'holiday_favorites'"); $stmtFav = $pdo->query("SELECT content FROM pf_notes WHERE note_type = 'holiday_favorites'");
+1 -2
View File
@@ -78,8 +78,7 @@ $pctSaved = $cost > 0 ? min(100 - $pctPaid, ($saved / $cost) * 100) : 0;
<h1><?= htmlspecialchars($holiday['title']) ?></h1> <h1><?= htmlspecialchars($holiday['title']) ?></h1>
<span class="hol-badge-status"><?= strtoupper($holiday['status']) ?></span> <span class="hol-badge-status"><?= strtoupper($holiday['status']) ?></span>
</div> </div>
<button onclick='editHoliday(<?= htmlspecialchars(json_encode(['main' => $holiday, 'items' => $generalItems]), ENT_QUOTES, 'UTF-8') ?>)' class="pf-btn btn-secondary">⚙️ Modifier les bases</button> <button onclick="editHoliday(<?= htmlspecialchars(json_encode(['main' => $holiday, 'items' => $generalItems]), ENT_QUOTES, 'UTF-8') ?>)" class="pf-btn btn-secondary pf-btn-small" style="width: auto; margin: 0;">⚙️ Modifier les bases</button> </div>
</div>
<div class="hol-summary-card"> <div class="hol-summary-card">
<div class="hol-summary-grid"> <div class="hol-summary-grid">