-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server-side CSV export for some reports #484
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is controlled by a newly added GET parameter. Set "format=csv" for it to output data in CSV format. Any other value for the format parameter, or not setting it at all, will output the usual expected JSON data. We have changed the internal key used to identify the columns from "$week-$year" to "$year-$week", so the list of columns can be easily sorted. We also added an index key to $records as a way to sort the rows. Sorting was not taken into consideration before, because it was performed by the client side. CSV export code is inspired by this example: https://www.virendrachandak.com/techtalk/creating-csv-file-using-php-and-mysql/
Access to the previous CSV exporter was not removed, for users to test and compare the two implementations.
This report queries two different services. Here, we implement server- -side CSV export for the extra hours fields. The CSV export code is inelegantly interspersed in the existing XML generation code. This service would likely need a complete rewrite to make things look better.
This report queries two different services. Here, we implement server- -side CSV export for the pending holiday hours field independently; it will be output to a different file from the rest of the fields in the report. This service would likely require a complete rewrite to make things better.
We rework and simplify the XML output code a bit, it looks better and allows us to reuse more for the CSV export. TODO: additional logic to patch user and project IDs with their names, because that happens client-side in the web page.
Old CSV exporter is not removed yet, as they have different features at the moment.
In getTasksFiltered.php we were escaping text fields for XML regardless of the requested format.
Add a new parameter for the service, "showProjectNames", which is enabled in CSV exports, which will and add the project name to the report output.
Add a new parameter for the service, "calculatePendingHolidays", enabled in CSV exports, which will call the GetPendingHolidayHours operation and add the data to the report. TODO: take advantage of this feature to simplify the front-end of this report, calling to one service instead of two.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement server-side CSV export for the following reports:
Enhancements to backend code were done if possible.
Implements #475, but there are some reports left.