Bug 25605: Replace NULL values with '' when downloading a report as a tab separated text

Test plan :
    1- Create a new report : select * from items;
    2- Run it
    3- Download the report as a tab separated text
    4- There's a lot of 'use of uninitialized value in join or string at ...koha/reports/guided_reports.pl line xxx.'
    in plack-error.log
    5- Apply patch
    6- Restart all
    7- Redo 2 and 3
    8- No more warning.
    9- diff both downloaded files, they must be the same.

Signed-off-by: Marco Abi-Ramia <marco.abi-ramia@inlibro.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Didier Gautheron 2020-05-26 13:31:31 +02:00 committed by Jonathan Druart
parent 12e1b2facc
commit 392a7e1a1f

View file

@ -902,7 +902,7 @@ elsif ($phase eq 'Export'){
$content .= join("\t", header_cell_values($sth)) . "\n";
$content = Encode::decode('UTF-8', $content);
while (my $row = $sth->fetchrow_arrayref()) {
$content .= join("\t", @$row) . "\n";
$content .= join("\t", map { $_ // '' } @$row) . "\n";
}
} else {
my $delimiter = C4::Context->preference('delimiter') || ',';