added categoryKey to questionnaire schema and updated related functions for questionnaire handling; enhanced API to fetch client answers

This commit is contained in:
2026-05-27 19:38:49 +02:00
parent 9c887537e8
commit 36b6d63266
9 changed files with 424 additions and 17 deletions

View File

@ -1172,8 +1172,9 @@ function qdb_import_questionnaire_bundle(PDO $pdo, array $item, bool $replaceIfE
$condJson = json_encode($condJson, JSON_UNESCAPED_UNICODE);
}
$pdo->prepare("INSERT INTO questionnaire (questionnaireID, name, version, state, orderIndex, showPoints, conditionJson)
VALUES (:id, :n, :v, :s, :o, :sp, :cj)")
$catKey = trim($meta['categoryKey'] ?? '');
$pdo->prepare("INSERT INTO questionnaire (questionnaireID, name, version, state, orderIndex, showPoints, conditionJson, categoryKey)
VALUES (:id, :n, :v, :s, :o, :sp, :cj, :ck)")
->execute([
':id' => $qnID,
':n' => trim($meta['name']),
@ -1182,6 +1183,7 @@ function qdb_import_questionnaire_bundle(PDO $pdo, array $item, bool $replaceIfE
':o' => $order,
':sp' => (int)($meta['showPoints'] ?? 0),
':cj' => $condJson ?: '{}',
':ck' => $catKey,
]);
foreach ($item['questions'] ?? [] as $q) {