review code pattern consistency

This commit is contained in:
Thanakorn S
2026-05-20 13:07:57 +07:00
parent 7396db6ffc
commit 91f8bb854f
20 changed files with 93 additions and 58 deletions
+4 -2
View File
@@ -24,7 +24,8 @@ $type = $data['type'] ?? '';
if (!$id || !$warehouse_id || !in_array($type, ['in', 'out', 'transfer'])) {
http_response_code(400);
exit(json_encode(['success' => 0, 'message' => 'Invalid parameters.']));
$answer['message'] = 'Invalid parameters.';
exit(json_encode($answer));
}
$stock = new StockManager($pdo2, $company_id);
@@ -44,5 +45,6 @@ try {
} catch (Exception $e) {
$pdo2->rollBack();
http_response_code(400);
exit(json_encode(['success' => 0, 'message' => $e->getMessage()]));
$answer['message'] = $e->getMessage();
exit(json_encode($answer));
}