From e41a159fd3f328a3fe94367702ca9c44b982ccd0 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 12 May 2021 15:23:14 +0200 Subject: [PATCH] Bug 28327: System preference CSVdelimiter special case for tabulation in perl System preference 'CSVdelimiter' has a special case for tabulation. Preference value contains string 'tabulation' but string '\t' must be used in CSV file. This is OK in many places, for exemple Bug 17590. This patch fixed when preference is fetch in perl. Test plan : 1) Set system preference 'CSVdelimiter' = 'tabs'. 2) Create CSV export in impacted pages 3) Check columns are separated by tabulation character and not string 'tabulation' --- admin/aqplan.pl | 1 + misc/cronjobs/overdue_notices.pl | 1 + reports/cash_register_stats.pl | 1 + tools/viewlog.pl | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/aqplan.pl b/admin/aqplan.pl index 5c85b7d7e0..234892e697 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -93,6 +93,7 @@ my $show_percent = $input->param('show_percent'); my $output = $input->param("output") // q{}; our $basename = $input->param("basename"); our $del = $input->param("sep"); +$del = "\t" if $del eq 'tabulation'; my $show_mine = $input->param('show_mine') ; diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index bf1a370a11..1e2e7bc48c 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -827,6 +827,7 @@ END_SQL my $content; if ( defined $csvfilename ) { my $delimiter = C4::Context->preference('CSVDelimiter') || ';'; + $delimiter = "\t" if $del eq 'tabulation'; $content = join($delimiter, qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n"; } else { diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl index a59fcdb5f7..be91bdceb1 100755 --- a/reports/cash_register_stats.pl +++ b/reports/cash_register_stats.pl @@ -158,6 +158,7 @@ if ($do_it) { my $reportname = $input->param('basename'); my $reportfilename = $reportname ? "$reportname.$format" : "reportresults.$format" ; my $delimiter = C4::Context->preference('CSVDelimiter') || ','; + $delimiter = "\t" if $delimiter eq 'tabulation'; my @rows; foreach my $row (@loopresult) { my @rowValues; diff --git a/tools/viewlog.pl b/tools/viewlog.pl index e67e911c40..d1ac92e396 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -226,8 +226,9 @@ if ($do_it) { # Printing to a csv file my $content = q{}; - my $delimiter = C4::Context->preference('CSVDelimiter') || ','; if (@data) { + my $delimiter = C4::Context->preference('CSVDelimiter') || ','; + $delimiter = "\t" if $delimiter eq 'tabulation'; my $csv = Text::CSV::Encoded->new( { encoding_out => 'utf8', sep_char => $delimiter } ); $csv or die "Text::CSV::Encoded->new FAILED: " . Text::CSV::Encoded->error_diag(); -- 2.30.2