fixed flag main
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user