Add manufacturer lot traceability
This commit is contained in:
1 parent
2aadce17bd
commit
19ce29c3d0
10 files changed
+418
-14
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
function system_write_audit_log(
|
||||
PDO $pdo,
|
||||
string $entityName,
|
||||
string $entityId,
|
||||
string $action,
|
||||
?string $changedBy,
|
||||
array $beforeData,
|
||||
array $afterData,
|
||||
array $context = []
|
||||
): void {
|
||||
$stmt = $pdo->prepare(
|
||||
"INSERT INTO audit_log (
|
||||
entity_name, entity_id, action, changed_by, before_data, after_data, context
|
||||
) VALUES (
|
||||
:entity_name, :entity_id, :action, :changed_by, :before_data::jsonb, :after_data::jsonb, :context::jsonb
|
||||
)"
|
||||
);
|
||||
$stmt->execute([
|
||||
':entity_name' => $entityName,
|
||||
':entity_id' => $entityId,
|
||||
':action' => $action,
|
||||
':changed_by' => $changedBy,
|
||||
':before_data' => json_encode($beforeData, JSON_THROW_ON_ERROR),
|
||||
':after_data' => json_encode($afterData, JSON_THROW_ON_ERROR),
|
||||
':context' => json_encode($context, JSON_THROW_ON_ERROR),
|
||||
]);
|
||||
}
|
||||
Reference in new issue
Block a user