From ca98acc1f20550bab087faebf8665fbb73a1d4e9 Mon Sep 17 00:00:00 2001 From: morgane Date: Sat, 27 Jun 2026 17:49:17 +0000 Subject: [PATCH] Actualiser api/index.php --- api/index.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/api/index.php b/api/index.php index 0793d77..e3d151a 100644 --- a/api/index.php +++ b/api/index.php @@ -9008,13 +9008,17 @@ function importMergeBackup(PDO $db): void { $exists->execute($params); $existingId = $exists->fetchColumn(); if ($existingId) { - // Update label/icon (and keywords if present) from prod, keep local id/is_builtin - $updCols = array_diff(array_keys($row), $uniqueCols, ['is_builtin', 'sort_order']); + $skipCols = array_merge($uniqueCols, ['is_builtin', 'sort_order']); + $updCols = []; + $updParams = []; + foreach ($row as $col => $val) { + if (in_array($col, $skipCols, true)) continue; + $updCols[] = "$col = ?"; + $updParams[] = $val; + } if (!empty($updCols)) { - $setClause = implode(', ', array_map(fn($c) => "$c = ?", $updCols)); - $updParams = array_map(fn($c) => $row[$c], $updCols); $updParams[] = $existingId; - $db->prepare("UPDATE {$table} SET {$setClause} WHERE id = ?")->execute($updParams); + $db->prepare("UPDATE {$table} SET " . implode(', ', $updCols) . " WHERE id = ?")->execute($updParams); } continue; }