Bugzilla – Attachment 120880 Details for
Bug 28327
System preference CSVdelimiter special case for tabulation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28327: use semicolon when preference CSVDelimiter is missing
Bug-28327-use-semicolon-when-preference-CSVDelimit.patch (text/plain), 8.75 KB, created by
Fridolin Somers
on 2021-05-12 13:46:17 UTC
(
hide
)
Description:
Bug 28327: use semicolon when preference CSVDelimiter is missing
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-05-12 13:46:17 UTC
Size:
8.75 KB
patch
obsolete
>From 67030797a2bdbdff1d3c28a63740785b836ade4c Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 12 May 2021 15:34:15 +0200 >Subject: [PATCH] Bug 28327: use semicolon when preference CSVDelimiter is > missing > >Some places use comma as value when preference CSVDelimiter is missing >or empty. >From installer/data/mysql/mandatory/sysprefs.sql whe see that defaut >install value is semicolon. > >This patch sets semicolon when preference CSVDelimiter is missing. > >"We are perl, we love semicolon ;)" >--- > Koha/Template/Plugin/Koha.pm | 2 +- > admin/aqplan.pl | 2 +- > .../prog/en/modules/admin/preferences/admin.pref | 2 +- > misc/cronjobs/fines.pl | 2 +- > misc/export_borrowers.pl | 4 ++-- > reports/bor_issues_top.pl | 2 +- > reports/cash_register_stats.pl | 2 +- > reports/guided_reports.pl | 2 +- > reports/orders_by_fund.pl | 2 +- > t/Koha_Template_Plugin_Koha.t | 8 ++++---- > tools/viewlog.pl | 2 +- > 11 files changed, 15 insertions(+), 15 deletions(-) > >diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm >index 2d34af0cc2..82865fafd7 100644 >--- a/Koha/Template/Plugin/Koha.pm >+++ b/Koha/Template/Plugin/Koha.pm >@@ -57,7 +57,7 @@ sub Preference { > > sub CSVDelimiter { > my ( $self, $val ) = @_; >- my $sep = $val || C4::Context->preference('CSVDelimiter') || ','; >+ my $sep = $val || C4::Context->preference('CSVDelimiter') || ';'; > $sep = "\t" if $sep eq 'tabulation'; > return $sep; > } >diff --git a/admin/aqplan.pl b/admin/aqplan.pl >index 234892e697..bbf775c380 100755 >--- a/admin/aqplan.pl >+++ b/admin/aqplan.pl >@@ -303,7 +303,7 @@ foreach my $n (@names) { > # DEFAULT DISPLAY BEGINS > > my $CGIextChoice = ( 'CSV' ); # FIXME translation >-my $CGIsepChoice = ( C4::Context->preference("CSVDelimiter") ); >+my $CGIsepChoice = ( C4::Context->preference("CSVDelimiter") || ';' ); > > my ( @budget_lines, %cell_hash ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index a858b1d0da..9623412918 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -44,7 +44,7 @@ Administration: > - > - "Default separator for columns in an exported CSV file: " > - pref: CSVDelimiter >- default: "," >+ default: ";" > choices: > ';': semicolons > tabulation: tabs >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index afc6b4d556..4d5bebdb42 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -99,7 +99,7 @@ my @other_fields = qw(days_overdue fine); > my $libname = C4::Context->preference('LibraryName'); > my $control = C4::Context->preference('CircControl'); > my $mode = C4::Context->preference('finesMode'); >-my $delim = "\t"; # ? C4::Context->preference('CSVDelimiter') || "\t"; >+my $delim = "\t"; # ? C4::Context->preference('CSVDelimiter') || ';'; > > my %is_holiday; > my $today = dt_from_string(); >diff --git a/misc/export_borrowers.pl b/misc/export_borrowers.pl >index 27292189e9..900fa4b97c 100755 >--- a/misc/export_borrowers.pl >+++ b/misc/export_borrowers.pl >@@ -49,7 +49,7 @@ $0 -h > Some characters like | or ; will need to be escaped > in the parameter setting, like -s=\\| or -s=\\; > If no separator is specified, the CSVDelimiter pref >- will be used (or a comma, if the pref is empty) >+ will be used (or a semicolon, if the pref is empty) > -H, --show-header Print field names on first row > -w, --where=CONDITION Condition to filter borrowers to export > (SQL where clause). >@@ -91,7 +91,7 @@ my $sth = $dbh->prepare($query); > $sth->execute; > > unless ( $separator ) { >- $separator = C4::Context->preference('CSVDelimiter') || ','; >+ $separator = C4::Context->preference('CSVDelimiter') || ';'; > $separator = "\t" if ($separator eq 'tabulation'); > } > >diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl >index 265362bb0d..b768a17973 100755 >--- a/reports/bor_issues_top.pl >+++ b/reports/bor_issues_top.pl >@@ -61,7 +61,7 @@ my ($template, $borrowernumber, $cookie) > flagsrequired => {reports => '*'}, > debug => 1, > }); >-our $sep = $input->param("sep") || C4::Context->preference('CSVDelimiter') || ','; >+our $sep = $input->param("sep") || C4::Context->preference('CSVDelimiter') || ';'; > $sep = "\t" if ($sep eq 'tabulation'); > $template->param(do_it => $do_it, > ); >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index be91bdceb1..b81d235db2 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -157,7 +157,7 @@ if ($do_it) { > my $format = 'csv'; > my $reportname = $input->param('basename'); > my $reportfilename = $reportname ? "$reportname.$format" : "reportresults.$format" ; >- my $delimiter = C4::Context->preference('CSVDelimiter') || ','; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ';'; > $delimiter = "\t" if $delimiter eq 'tabulation'; > my @rows; > foreach my $row (@loopresult) { >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 49dfc95a3e..1daf85356d 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -898,7 +898,7 @@ elsif ($phase eq 'Export'){ > $content .= join("\t", map { $_ // '' } @$row) . "\n"; > } > } else { >- my $delimiter = C4::Context->preference('CSVDelimiter') || ','; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ';'; > if ( $format eq 'csv' ) { > $delimiter = "\t" if $delimiter eq 'tabulation'; > $type = 'application/csv'; >diff --git a/reports/orders_by_fund.pl b/reports/orders_by_fund.pl >index 6ffe018c9a..5313cbbdd5 100755 >--- a/reports/orders_by_fund.pl >+++ b/reports/orders_by_fund.pl >@@ -209,7 +209,7 @@ else { > $template->param( budgetsloop => \@{$budgetloop}, > outputFormatloop => \@outputFormats, > delimiterloop => \@CSVdelimiters, >- delimiterPreference => C4::Context->preference('CSVDelimiter') >+ delimiterPreference => C4::Context->preference('CSVDelimiter') || ';' > ); > } > >diff --git a/t/Koha_Template_Plugin_Koha.t b/t/Koha_Template_Plugin_Koha.t >index 812f5f96cc..e7ab8cb625 100755 >--- a/t/Koha_Template_Plugin_Koha.t >+++ b/t/Koha_Template_Plugin_Koha.t >@@ -96,13 +96,13 @@ subtest "Koha::Template::Plugin::Koha::CSVDelimiter tests" => sub { > my $plugin = Koha::Template::Plugin::Koha->new(); > > t::lib::Mocks::mock_preference('CSVDelimiter', ''); >- is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is empty string"); >+ is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns semicolon when preference is empty string"); > > t::lib::Mocks::mock_preference('CSVDelimiter', undef); >- is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is undefined"); >+ is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns semicolon when preference is undefined"); > >- t::lib::Mocks::mock_preference('CSVDelimiter', ';'); >- is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns preference value when preference is not tabulation"); >+ t::lib::Mocks::mock_preference('CSVDelimiter', ','); >+ is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns preference value when preference is not tabulation"); > > t::lib::Mocks::mock_preference('CSVDelimiter', 'tabulation'); > is($plugin->CSVDelimiter(), "\t", "CSVDelimiter() returns \\t when preference is tabulation"); >diff --git a/tools/viewlog.pl b/tools/viewlog.pl >index d1ac92e396..22fc88e4ec 100755 >--- a/tools/viewlog.pl >+++ b/tools/viewlog.pl >@@ -227,7 +227,7 @@ if ($do_it) { > # Printing to a csv file > my $content = q{}; > if (@data) { >- my $delimiter = C4::Context->preference('CSVDelimiter') || ','; >+ 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28327
:
120859
|
120861
|
120867
|
120868
|
120869
|
120870
|
120871
|
120872
|
120873
|
120874
|
120876
|
120877
|
120878
|
120879
|
120880
|
120881
|
126682
|
126683
|
126684
|
126685
|
126964
|
126965
|
126966
|
126967
|
131995
|
131996
|
131997
|
136378
|
136379
|
136380
|
136381
|
136473
|
136474
|
136475
|
136535
|
136536
|
136537
|
139479
|
139513
|
139514
|
139515
|
139516