This commit is contained in:
2026-01-21 01:00:50 +01:00
parent 1992502cd3
commit 107de0b7db
2 changed files with 16 additions and 7 deletions

View File

@@ -857,6 +857,16 @@ class ApiKernel
foreach ($data as $k => $v) $stmt->bindValue(":$k", $v);
$stmt->execute();
$newId = (int)$this->pdo->lastInsertId();
try {
$stmt = $this->pdo->prepare("SELECT * FROM `$itemsTable` WHERE `id` = :id AND `customer_id` = :cid LIMIT 1");
$stmt->execute([':id' => $newId, ':cid' => $customerId]);
$row = $stmt->fetch();
if ($row) {
$this->createContentVersion($row, $itemCols, $customerId, (int)$section['id']);
}
} catch (Throwable $e) {
// ignore versioning failures on create
}
$this->respond(['ok' => true, 'kind' => 'content', 'id' => $newId, 'item' => ['id' => $newId, 'name' => $name]]);
}