changes to translation system
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
tom.hempel
2026-07-09 14:59:56 +02:00
parent 4afab336ee
commit f04388e0ec
24 changed files with 1882 additions and 415 deletions

View File

@ -62,7 +62,45 @@ case 'GET':
break;
case 'POST':
$body = read_json_body();
$body = read_json_body();
if (($body['action'] ?? '') === 'reset') {
$clientCode = trim((string)($body['clientCode'] ?? ''));
if ($clientCode === '') {
json_error('MISSING_FIELDS', 'clientCode is required', 400);
}
try {
[$pdo, $tmpDb, $lockFp] = qdb_open_write_or_fail();
[$clause, $params] = rbac_client_filter($tokenRec, 'cl', 'all');
$chk = $pdo->prepare(
"SELECT clientCode FROM client cl WHERE cl.clientCode = :cc AND ($clause)"
);
$chk->execute(array_merge([':cc' => $clientCode], $params));
if (!$chk->fetch()) {
qdb_discard($tmpDb, $lockFp);
json_error('NOT_FOUND', 'Client not found or not authorized', 404);
}
require_once __DIR__ . '/../lib/submissions.php';
$pdo->beginTransaction();
$cleared = qdb_delete_client_response_data($pdo, [$clientCode]);
$pdo->commit();
qdb_save($tmpDb, $lockFp);
json_success([
'clientCode' => $clientCode,
'reset' => true,
'cleared' => $cleared,
]);
} catch (Throwable $e) {
qdb_handler_fail($e, 'clients', $pdo ?? null, $tmpDb ?? null, $lockFp ?? null);
}
break;
}
$coachID = trim($body['coachID'] ?? '');
$bulk = !empty($body['bulk']);