fixed flag main

This commit is contained in:
2026-07-01 12:19:11 +02:00
parent 6ad10c4d8f
commit 2c7ddbcfeb
+3 -2
View File
@@ -46,7 +46,7 @@ try {
$stmt = $pdo->prepare("
SELECT COUNT(*)
FROM template_mapping
WHERE template_id = ? AND main_field = 1 AND id != ?
WHERE template_id = ? AND main_field = '1' AND id != ?
");
$stmt->execute([$templateId, $mappingId]);
$count = (int)$stmt->fetchColumn();
@@ -76,8 +76,9 @@ try {
$uncheckedOthers = $stmt->rowCount() > 0;
}
$bindValue = ($field === 'main_field') ? (string)$value : $value;
$stmt = $pdo->prepare("UPDATE template_mapping SET {$field} = ? WHERE id = ?");
$result = $stmt->execute([$value, $mappingId]);
$result = $stmt->execute([$bindValue, $mappingId]);
if (!$result) {
$pdo->rollBack();