Bug 22323: cronjob runreport.pl CSV add encoding
authorFridolin Somers <fridolin.somers@biblibre.com>
Wed, 13 Feb 2019 12:25:20 +0000 (13:25 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 25 Feb 2019 15:32:04 +0000 (15:32 +0000)
commit0ad76960cd24b3f12eb5c0e7058f02cd13ba1ac0
treee1dd0fbc6fe5f3a37d7272155f8b2cb6c3e7bc43
parent220d6e95956b9efb9daee135fb2a66d273032785
Bug 22323: cronjob runreport.pl CSV add encoding

Cronjob runreport.pl runs SQL reports and can export as CSV.
This export needs to be UTF-8 encoded.

This pathes replaces use of Text::CSV_XS by Text::CSV::Encoded like in other places like tools/viewlog.pl.
It adds a decode of headers bcause they will be encoded lika other lines.

Test plan:
1) Create a new item with itemnotes 'accentué'
2) Create a SQL report with :
SELECT barcode,itemnotes AS itè FROM items WHERE itemnotes LIKE 'accenté'
3) Run this report
4) You see well encoded header and content
5) Run from command line (replace X by report number) :
misc/cronjobs/runreport.pl X --format=csv --csv-header --store-results
6) You well encoded header and content
7) Go to saved reports table
8) Look at saved results of report
9) You well encoded header and content

Signed-off-by: Mikaël Olangcay Brisebois <mikael.olangcay-brisebois@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 83fe95d0c5d404a2ffc6ed35e822ff0f5ee8b6e6)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
misc/cronjobs/runreport.pl