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 <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7b645b0208)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4cf509b248)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Fridolin Somers 2022-06-23 21:38:11 -10:00 committed by Arthur Suzuki
parent 32211362ab
commit fd853a50f3
3 changed files with 8 additions and 8 deletions

View File

@ -482,8 +482,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
@ -493,7 +493,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;
}

View File

@ -174,7 +174,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','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'),
('displayFacetCount','0',NULL,NULL,'YesNo'),

View File

@ -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" );