diff --git a/app/Domain/Tickets/Controllers/TicketHistoryController.php b/app/Domain/Tickets/Controllers/TicketHistoryController.php index cd2ea849fd..0f6f377000 100644 --- a/app/Domain/Tickets/Controllers/TicketHistoryController.php +++ b/app/Domain/Tickets/Controllers/TicketHistoryController.php @@ -29,7 +29,7 @@ public function logStatusChange(): JsonResponse { if (!$this->authService->loggedIn()) { return new JsonResponse([ - 'success' => false, + 'success' => false, 'error' => 'Unauthorized' ], 401); } @@ -44,7 +44,7 @@ public function logStatusChange(): JsonResponse if (!$ticketId) { return new JsonResponse([ - 'success' => false, + 'success' => false, 'error' => 'No ticket ID provided' ], 400); } @@ -68,7 +68,7 @@ public function logStatusChange(): JsonResponse ]); } else { return new JsonResponse([ - 'success' => false, + 'success' => false, 'error' => 'Failed to save status change' ], 500); } @@ -101,32 +101,50 @@ public function getStatusChanges(): Response $html = ''; } return new Response($html, 200, ['Content-Type' => 'text/html']); - } catch (\Exception $e) { return new Response( '

Error loading status changes: ' . htmlspecialchars($e->getMessage()) . '

', diff --git a/app/Domain/Tickets/Templates/submodules/ticketDetails.sub.php b/app/Domain/Tickets/Templates/submodules/ticketDetails.sub.php index 135e84d672..309df5eede 100644 --- a/app/Domain/Tickets/Templates/submodules/ticketDetails.sub.php +++ b/app/Domain/Tickets/Templates/submodules/ticketDetails.sub.php @@ -223,6 +223,49 @@ function loadStatusHistory(ticketId) { const ticketIdOnLoad = $('#status-change-log').data('ticket-id'); if (ticketIdOnLoad) { loadStatusHistory(ticketIdOnLoad); + } + window.initialTicketDescription = ''; + + if (typeof tinymce !== 'undefined') { + tinymce.on('AddEditor', function(e) { + if (e.editor.id === 'ticketDescription') { + e.editor.on('init', function() { + window.initialTicketDescription = e.editor.getContent(); + }); + + e.editor.off('SaveContent'); + + e.editor.on('SaveContent', function() { + const currentDescription = e.editor.getContent(); + + if (window.initialTicketDescription !== currentDescription) { + const ticketId = $('#status-change-log').data('ticket-id'); + const user = $('#status-select').data('user') || 'Unknown User'; + + $.ajax({ + url: '/tickets/ticketHistoryController/logStatusChange', + method: 'POST', + data: { + ticketId: ticketId, + oldStatus: '', + newStatus: '', + oldStatusText: window.initialTicketDescription, + newStatusText: currentDescription, + user: user, + detailsAttributeId: 'ticketDescription' + }, + success: function(response) { + window.initialTicketDescription = currentDescription; + loadStatusHistory(ticketId); + }, + error: function(xhr, status, error) { + console.error('Error logging description:', error); + } + }); + } + }); + } + }); } $('#status-select, #priority, #storypoints, #editorId, #deadline').on('change', function() { diff --git a/app/Domain/Tickets/Templates/submodules/timesheet.sub.php b/app/Domain/Tickets/Templates/submodules/timesheet.sub.php index 5e1da83eee..712087182d 100644 --- a/app/Domain/Tickets/Templates/submodules/timesheet.sub.php +++ b/app/Domain/Tickets/Templates/submodules/timesheet.sub.php @@ -45,7 +45,7 @@ -
+
diff --git a/app/Domain/Timesheets/Repositories/Timesheets.php b/app/Domain/Timesheets/Repositories/Timesheets.php index d46465a9a2..fd78bee542 100644 --- a/app/Domain/Timesheets/Repositories/Timesheets.php +++ b/app/Domain/Timesheets/Repositories/Timesheets.php @@ -15,12 +15,12 @@ class Timesheets extends Repository private DbCore $db; public array $kind = [ - 'GENERAL_BILLABLE' => 'label.general_billable', - 'GENERAL_NOT_BILLABLE' => 'label.general_not_billable', - 'PROJECTMANAGEMENT' => 'label.projectmanagement', - 'DEVELOPMENT' => 'label.development', - 'BUGFIXING_NOT_BILLABLE' => 'label.bugfixing_not_billable', - 'TESTING' => 'label.testing', + 'GENERAL_BILLABLE' => 'General, billable', + 'GENERAL_NOT_BILLABLE' => 'General, not billable', + 'PROJECTMANAGEMENT' => 'Project management', + 'DEVELOPMENT' => 'Development', + 'BUGFIXING_NOT_BILLABLE' => 'Bugfixing, not billable', + 'TESTING' => 'Testing', ]; /** diff --git a/app/Domain/Timesheets/Templates/showAll.tpl.php b/app/Domain/Timesheets/Templates/showAll.tpl.php index 8d140dcb05..03e85ff174 100644 --- a/app/Domain/Timesheets/Templates/showAll.tpl.php +++ b/app/Domain/Timesheets/Templates/showAll.tpl.php @@ -188,7 +188,7 @@ function updateProjectCountInline() { - get('allClients') as $client) {?>