- 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
788 B
PHP
24 lines
788 B
PHP
<?php
|
|
require_once __DIR__ . '/../../../session.php';
|
|
require_once '../../../assets/utils/db_auth.php';
|
|
require_once '../../../assets/utils/classes/BatchActionManager.php';
|
|
|
|
// Logged at the end of a batch GL posting run, which is owner/admin only.
|
|
require_role($user_role, ['owner', 'admin']);
|
|
|
|
try {
|
|
$batch_action = new BatchActionManager($pdo2, $company_id, $user_id);
|
|
$batch_action->log($data);
|
|
$answer['success'] = 1;
|
|
$answer['message'] = 'Batch action logged.';
|
|
} catch (PDOException $e) {
|
|
error_log('[log_batch_action] ' . $e->getMessage());
|
|
http_response_code(500);
|
|
$answer['message'] = 'Database error, please try again.';
|
|
} catch (Exception $e) {
|
|
http_response_code(400);
|
|
$answer['message'] = $e->getMessage();
|
|
}
|
|
|
|
exit(json_encode($answer));
|