From 7b645b0208182520d91ff370b6a4e5b79549d2e0 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 23 Jun 2022 21:38:11 -1000 Subject: [PATCH] Bug 28327: (follow-up) Comma as default CSV delimiter Looks like most of existing code wants comma as default value. Also impact installer/data/mysql/mandatory/sysprefs.sql. Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Context.pm | 6 +++--- installer/data/mysql/mandatory/sysprefs.sql | 2 +- t/Context.t | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 876126b888..654414de3c 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -483,8 +483,8 @@ sub delete_preference { $delimiter = C4::Context->csv_delimiter; - Returns prefered CSV delimiter, using system preference 'CSVDelimiter'. - If this preference is missing or empty semicolon will be returned. + Returns preferred CSV delimiter, using system preference 'CSVDelimiter'. + If this preference is missing or empty, comma will be returned. This method is needed because of special behavior for tabulation. You can, optionally, pass a value parameter to this routine @@ -494,7 +494,7 @@ sub delete_preference { sub csv_delimiter { my ( $self, $value ) = @_; - my $delimiter = $value || $self->preference('CSVDelimiter') || ';'; + my $delimiter = $value || $self->preference('CSVDelimiter') || ','; $delimiter = "\t" if $delimiter eq 'tabulation'; return $delimiter; } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 227049afe5..98d1fa443d 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -182,7 +182,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DefaultToLoggedInLibraryCircRules', '0', NULL , 'If enabled, circ rules editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), ('DefaultToLoggedInLibraryNoticesSlips', '0', NULL , 'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), -('CSVDelimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), +('CSVDelimiter',',',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding staff interface XSLT option must be on','Choice'), ('DisplayClearScreenButton','no','no|issueslip|issueqslip','If set to ON, a clear screen button will appear on the circulation page.','Choice'), ('displayFacetCount','0',NULL,NULL,'YesNo'), diff --git a/t/Context.t b/t/Context.t index 8d353e35f6..f3e15a56c1 100755 --- a/t/Context.t +++ b/t/Context.t @@ -68,13 +68,13 @@ subtest 'csv_delimiter() tests' => sub { plan tests => 4; t::lib::Mocks::mock_preference( 'CSVDelimiter', undef ); - is( C4::Context->csv_delimiter, ';', "csv_delimiter returns semicolon if system preference CSVDelimiter is undefined" ); + is( C4::Context->csv_delimiter, ',', "csv_delimiter returns comma if system preference CSVDelimiter is undefined" ); t::lib::Mocks::mock_preference( 'CSVDelimiter', '' ); - is( C4::Context->csv_delimiter, ';', "csv_delimiter returns semicolon if system preference CSVDelimiter is empty string" ); + is( C4::Context->csv_delimiter, ',', "csv_delimiter returns comma if system preference CSVDelimiter is empty string" ); - t::lib::Mocks::mock_preference( 'CSVDelimiter', ',' ); - is( C4::Context->csv_delimiter, ',', "csv_delimiter returns comma if system preference CSVDelimiter is comma" ); + t::lib::Mocks::mock_preference( 'CSVDelimiter', ';' ); + is( C4::Context->csv_delimiter, ';', "csv_delimiter returns semicolon if system preference CSVDelimiter is semicolon" ); t::lib::Mocks::mock_preference( 'CSVDelimiter', 'tabulation' ); is( C4::Context->csv_delimiter, "\t", "csv_delimiter returns '\t' if system preference CSVDelimiter is tabulation" ); -- 2.39.5