fix: Fix upload_attachment.php AuditLogModel call

- Fix AuditLogModel instantiation with proper $conn parameter
- Fix log() call parameter order (details should be array, not ipAddress)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-20 17:01:42 -05:00
parent ebf318f8af
commit 92f936e1be

View File

@@ -171,20 +171,28 @@ try {
} }
// Log the upload // Log the upload
$auditLog = new AuditLogModel(); $conn = new mysqli(
$auditLog->log( $GLOBALS['config']['DB_HOST'],
$_SESSION['user']['user_id'], $GLOBALS['config']['DB_USER'],
'attachment_upload', $GLOBALS['config']['DB_PASS'],
'ticket_attachments', $GLOBALS['config']['DB_NAME']
$attachmentId,
null,
json_encode([
'ticket_id' => $ticketId,
'filename' => $originalFilename,
'size' => $file['size'],
'mime_type' => $mimeType
])
); );
if (!$conn->connect_error) {
$auditLog = new AuditLogModel($conn);
$auditLog->log(
$_SESSION['user']['user_id'],
'attachment_upload',
'ticket_attachments',
(string)$attachmentId,
[
'ticket_id' => $ticketId,
'filename' => $originalFilename,
'size' => $file['size'],
'mime_type' => $mimeType
]
);
$conn->close();
}
ResponseHelper::created([ ResponseHelper::created([
'attachment_id' => $attachmentId, 'attachment_id' => $attachmentId,