Bug 21035: Handle new lines when running reports

See https://metacpan.org/pod/Text::CSV_XS#Embedded-newlines

Test plan:

1) Choose two items, say barcode '123' and '456'
2) Change the public note on 123 to read

Line1
Line2

(I.e. type 'Line1', then press Enter, type 'Line2' and click update).
3) Change the public note on 456 to read

Public note has one and only one line.

Click update.
4) Create a report with the followng query:

select barcode, itemnotes from items where barcode in ( '123', '456' )

Let's say that this is report number 10.

5) run ./misc/cronjobs/runreport.pl --format=csv REPORT_ID:

=> You should see both lines

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2018-07-04 15:05:25 -03:00 committed by Nick Clemens
parent f4cf075fbe
commit f16fb888f1

View file

@ -274,6 +274,7 @@ foreach my $report_id (@ARGV) {
$message = $cgi->table(join "", @rows);
} elsif ($format eq 'csv') {
my $csv = Text::CSV_XS->new({
binary => 1,
quote_char => $quote,
sep_char => $separator,
});