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(
$GLOBALS['config']['DB_HOST'],
$GLOBALS['config']['DB_USER'],
$GLOBALS['config']['DB_PASS'],
$GLOBALS['config']['DB_NAME']
);
if (!$conn->connect_error) {
$auditLog = new AuditLogModel($conn);
$auditLog->log( $auditLog->log(
$_SESSION['user']['user_id'], $_SESSION['user']['user_id'],
'attachment_upload', 'attachment_upload',
'ticket_attachments', 'ticket_attachments',
$attachmentId, (string)$attachmentId,
null, [
json_encode([
'ticket_id' => $ticketId, 'ticket_id' => $ticketId,
'filename' => $originalFilename, 'filename' => $originalFilename,
'size' => $file['size'], 'size' => $file['size'],
'mime_type' => $mimeType 'mime_type' => $mimeType
]) ]
); );
$conn->close();
}
ResponseHelper::created([ ResponseHelper::created([
'attachment_id' => $attachmentId, 'attachment_id' => $attachmentId,