https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41626

--- Comment #1 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 203487
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203487&action=edit
Bug 41626: Use Koha::CSV for report exports

This patch replaces Text::CSV::Encoded with Koha::CSV in both
reports/guided_reports.pl and misc/cronjobs/runreport.pl.

This is a straightforward swap using the low-level API (combine/string)
since report CSV exports have fully dynamic columns determined by the
SQL query at runtime, making the columns() subclass pattern unsuitable.

Benefits:
- CSVDelimiter system preference used consistently
- formula => empty enforced (prevents formula injection)
- binary => 1 always set (UTF-8 safe)
- No more Encode::decode wrapping (Koha::CSV handles encoding)
- Removes dependency on Text::CSV::Encoded

Note: runreport.pl --quote option is not wired through since
Koha::CSV uses the Text::CSV_XS default (double quote). This
matches the previous default behavior. A future enhancement could
expose quote_char as a Koha::CSV constructor param if needed.

Test plan:
1. Apply patches
2. Run a saved report from the staff interface, export as CSV
=> SUCCESS: CSV generated with correct delimiter and quoting
3. Run from command line:
   $ ktd --shell
   k$ perl misc/cronjobs/runreport.pl --format=csv --csv-header 1
=> SUCCESS: CSV output with headers
4. Test with custom separator:
   k$ perl misc/cronjobs/runreport.pl --format=csv --separator=";" 1
=> SUCCESS: Semicolon separator used
5. Open in Excel/LibreOffice
=> SUCCESS: No formula injection, proper quoting
6. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to