feat: add Excel (XLSX) export for task time entries#278
Conversation
Adds a new endpoint GET /times/export/xlsx?task_uuid=<uuid>&timezone=<tz> that exports all time entries for a specific task to an Excel file. Changes: - lib/Helper/ArrayToXLSX.php: new helper using native CSV-to-spreadsheet conversion via SpreadsheetWriter (pure PHP, no extra dependencies) - lib/Controller/PageController.php: new exportTaskXlsx() method - appinfo/routes.php: new route page#exportTaskXlsx - templates/times.php: 'Export Excel' button in the task detail header
|
Hello! Thank you for contributing a PR 😊 I have a few questions/annotations:
(b) You also don't seem to have put a button on the reports page to actually export to XLSX? I would expect the button to be there, next to the CSV button, instead of on the task page. (c) Additionally, the columns of the reports export seems to be different from the columns of the task export. Is that on purpose?
One last thing: I haven't defined a contributing guide, so don't take this the wrong way: Would you mind to disclose to which degree you've used LLM or taken inspiration from other repositories to create code in this PR (especially the ArrayToXLSX class)? It helps me evaluate if your PR could include code or snippets of other projects where I need to check the license before including in my project. |
| * @NoAdminRequired | ||
| * @NoCSRFRequired | ||
| */ | ||
| function settings(): TemplateResponse { |
There was a problem hiding this comment.
Why did you remove the settings controller as well as the getSettings method?
Summary
Adds the ability to export all time entries of a specific task to an Excel (.xlsx) file, making it easy to share time tracking statistics with clients or colleagues outside of Nextcloud.
Changes
New file:
lib/Helper/ArrayToXLSX.phpPure PHP helper class that converts an array of time entries into a formatted
.xlsxspreadsheet:SUMformula on thedurationcolumnModified:
lib/Controller/PageController.phpuse OCA\TimeManager\Helper\ArrayToXLSX;exportTaskXlsx(string $task_uuid, string $timezone)method: fetches all time entries for the given task, resolves task/project/client names and author display names, respects the user's timezone and the input method setting (decimal vs. minutes), and returns aDataDownloadResponsewith the.xlsxfilereports()to also supportformat=xlsx(same data as CSV export, different format)Modified:
appinfo/routes.phpGET /times/export/xlsx→page#exportTaskXlsxModified:
templates/times.phptask_uuidand the user's server timezone to the export endpointExport columns
datestartenddurationnotestatuspaid/unpaidauthortaskprojectclient