Bug 17590 - Exporting reports as CSV with 'delimiter' SysPref set to 'tabulation...
authorNick Clemens <nick@bywatersolutions.com>
Tue, 8 Nov 2016 17:26:36 +0000 (17:26 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 18 Nov 2016 14:14:54 +0000 (14:14 +0000)
To test:
Set 'delimiter' system preference to 'tabs'
Export a report as csv
Open the file in text editor and note fields separated by character 't'
Apply patch
Export report as CSV
Open file in text editor and note tabs are used to separate fields

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
tabs now, no errors.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

reports/guided_reports.pl

index 9c42863..a5e15be 100755 (executable)
@@ -830,6 +830,7 @@ elsif ($phase eq 'Export'){
         } else {
             my $delimiter = C4::Context->preference('delimiter') || ',';
             if ( $format eq 'csv' ) {
+                $delimiter = "\t" if $delimiter eq 'tabulation';
                 $type = 'application/csv';
                 my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter});
                 $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();