fixed flag main
This commit is contained in:
@@ -46,7 +46,7 @@ try {
|
|||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM template_mapping
|
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]);
|
$stmt->execute([$templateId, $mappingId]);
|
||||||
$count = (int)$stmt->fetchColumn();
|
$count = (int)$stmt->fetchColumn();
|
||||||
@@ -76,8 +76,9 @@ try {
|
|||||||
$uncheckedOthers = $stmt->rowCount() > 0;
|
$uncheckedOthers = $stmt->rowCount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bindValue = ($field === 'main_field') ? (string)$value : $value;
|
||||||
$stmt = $pdo->prepare("UPDATE template_mapping SET {$field} = ? WHERE id = ?");
|
$stmt = $pdo->prepare("UPDATE template_mapping SET {$field} = ? WHERE id = ?");
|
||||||
$result = $stmt->execute([$value, $mappingId]);
|
$result = $stmt->execute([$bindValue, $mappingId]);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$pdo->rollBack();
|
$pdo->rollBack();
|
||||||
|
|||||||
Reference in New Issue
Block a user