snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.87k stars 3.14k forks source link

Custom CSV-separator when generating reports #9916

Open Blue3agle opened 3 years ago

Blue3agle commented 3 years ago

Hello.

In Norway we use seimcolon (;) by default to separate values in CSV-files when importing into Excel. Currently the comma (,) is hard-coded into app/Http/Controllers/ReportsController.php.

This should be a configuration setting that sets the separator, and then use it in ReportsController.php by replacing $rows[] = implode($row, ','); with $rows[] = implode($row, $CSV_separator);

and fputcsv($handle, $header); with fputcsv($handle, $header, $CSV_separator);

Obviously $CSV_separator would be the variable holding the current configured value.

Server (please complete the following information):

Is your feature request related to a problem? Please describe. When we export CSV-files we cannot directly open them in Excel. We have to save them to disk, start Excel and then select "Open" and open the file and then specify comma (,) as CSV-separator

Describe the solution you'd like This can be solved in two steps

  1. Add a configuration setting that specifies the CSV value separator
  2. Change the ReportsController to use that variable

Describe alternatives you've considered I have changed the ReportsController on my server to hard-coded semicolons (;), but this will be overwritten upon upgrades, and is not a good solution.

Additional context I am looking to deploy this for a client, and I do not want to have to maintain this with patches when the system is upgraded in the future. That would be extra frustration (and cost) for my client. :)

welcome[bot] commented 3 years ago

šŸ‘‹ Thanks for opening your first issue here! If you're reporting a šŸž bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 3 years ago

Excel can handle either very easily - I'm not sure we need an extra setting for this. I'd be willing to look at a PR for this though.