- users, SMTP and batch-lock endpoints are owner/admin only - engines answer 400/403/404/409/500 instead of 200 with an error body; database errors no longer leak to the client
24 lines
597 B
PHP
24 lines
597 B
PHP
<?php
|
|
require_once __DIR__ . '/../../../session.php';
|
|
require_once '../../../assets/utils/db_auth.php';
|
|
require_once '../../../assets/utils/classes_ac/ChartOfAccounts.php';
|
|
|
|
$id = (int)($data['id'] ?? 0);
|
|
if (!$id) {
|
|
http_response_code(400);
|
|
$answer['message'] = 'Missing id';
|
|
exit(json_encode($answer));
|
|
}
|
|
|
|
$coa = new ChartOfAccounts($pdo2, $company_id);
|
|
$row = $coa->getById($id);
|
|
if (!$row) {
|
|
http_response_code(404);
|
|
$answer['message'] = 'Account not found';
|
|
exit(json_encode($answer));
|
|
}
|
|
|
|
$answer['output'] = $row;
|
|
$answer['success'] = 1;
|
|
exit(json_encode($answer));
|