View | Details | Raw Unified | Return to bug 28363
Collapse All | Expand All

(-)a/Koha/Template/Plugin/Koha.pm (-1 / +1 lines)
Lines 68-74 being fetched in the scripts and still needing to be translated Link Here
68
68
69
sub CSVDelimiter {
69
sub CSVDelimiter {
70
    my ( $self, $val ) = @_;
70
    my ( $self, $val ) = @_;
71
    my $sep = $val || C4::Context->preference('CSVDelimiter') || ',';
71
    my $sep = $val || C4::Context->preference('CSVDelimiter') || ';';
72
    $sep = "\t" if $sep eq 'tabulation';
72
    $sep = "\t" if $sep eq 'tabulation';
73
    return $sep;
73
    return $sep;
74
}
74
}
(-)a/admin/aqplan.pl (-1 / +1 lines)
Lines 303-309 foreach my $n (@names) { Link Here
303
#         DEFAULT DISPLAY BEGINS
303
#         DEFAULT DISPLAY BEGINS
304
304
305
my $CGIextChoice = ( 'CSV' ); # FIXME translation
305
my $CGIextChoice = ( 'CSV' ); # FIXME translation
306
my $CGIsepChoice = ( C4::Context->preference("CSVDelimiter") );
306
my $CGIsepChoice = ( C4::Context->preference("CSVDelimiter") || ';' );
307
307
308
my ( @budget_lines, %cell_hash );
308
my ( @budget_lines, %cell_hash );
309
309
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (-1 / +1 lines)
Lines 44-50 Administration: Link Here
44
        -
44
        -
45
            - "Default separator for columns in an exported CSV file: "
45
            - "Default separator for columns in an exported CSV file: "
46
            - pref: CSVDelimiter
46
            - pref: CSVDelimiter
47
              default: ","
47
              default: ";"
48
              choices:
48
              choices:
49
                  ';': semicolons
49
                  ';': semicolons
50
                  tabulation: tabs
50
                  tabulation: tabs
(-)a/misc/cronjobs/fines.pl (-1 / +1 lines)
Lines 99-105 my @other_fields = qw(days_overdue fine); Link Here
99
my $libname      = C4::Context->preference('LibraryName');
99
my $libname      = C4::Context->preference('LibraryName');
100
my $control      = C4::Context->preference('CircControl');
100
my $control      = C4::Context->preference('CircControl');
101
my $mode         = C4::Context->preference('finesMode');
101
my $mode         = C4::Context->preference('finesMode');
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || ';';
103
103
104
my %is_holiday;
104
my %is_holiday;
105
my $today = dt_from_string();
105
my $today = dt_from_string();
(-)a/misc/export_borrowers.pl (-2 / +2 lines)
Lines 49-55 $0 -h Link Here
49
                            Some characters like | or ; will need to be escaped
49
                            Some characters like | or ; will need to be escaped
50
                            in the parameter setting, like -s=\\| or -s=\\;
50
                            in the parameter setting, like -s=\\| or -s=\\;
51
                            If no separator is specified, the CSVDelimiter pref
51
                            If no separator is specified, the CSVDelimiter pref
52
                            will be used (or a comma, if the pref is empty)
52
                            will be used (or a semicolon, if the pref is empty)
53
    -H, --show-header       Print field names on first row
53
    -H, --show-header       Print field names on first row
54
    -w, --where=CONDITION   Condition to filter borrowers to export
54
    -w, --where=CONDITION   Condition to filter borrowers to export
55
                            (SQL where clause).
55
                            (SQL where clause).
Lines 91-97 my $sth = $dbh->prepare($query); Link Here
91
$sth->execute;
91
$sth->execute;
92
92
93
unless ( $separator ) {
93
unless ( $separator ) {
94
    $separator = C4::Context->preference('CSVDelimiter') || ',';
94
    $separator = C4::Context->preference('CSVDelimiter') || ';';
95
    $separator = "\t" if ($separator eq 'tabulation');
95
    $separator = "\t" if ($separator eq 'tabulation');
96
}
96
}
97
97
(-)a/reports/bor_issues_top.pl (-1 / +1 lines)
Lines 61-67 my ($template, $borrowernumber, $cookie) Link Here
61
                flagsrequired => {reports => '*'},
61
                flagsrequired => {reports => '*'},
62
                debug => 1,
62
                debug => 1,
63
                });
63
                });
64
our $sep     = $input->param("sep") || C4::Context->preference('CSVDelimiter') || ',';
64
our $sep     = $input->param("sep") || C4::Context->preference('CSVDelimiter') || ';';
65
$sep = "\t" if ($sep eq 'tabulation');
65
$sep = "\t" if ($sep eq 'tabulation');
66
$template->param(do_it => $do_it,
66
$template->param(do_it => $do_it,
67
        );
67
        );
(-)a/reports/cash_register_stats.pl (-1 / +1 lines)
Lines 157-163 if ($do_it) { Link Here
157
        my $format = 'csv';
157
        my $format = 'csv';
158
        my $reportname = $input->param('basename');
158
        my $reportname = $input->param('basename');
159
        my $reportfilename = $reportname ? "$reportname.$format" : "reportresults.$format" ;
159
        my $reportfilename = $reportname ? "$reportname.$format" : "reportresults.$format" ;
160
        my $delimiter = C4::Context->preference('CSVDelimiter') || ',';
160
        my $delimiter = C4::Context->preference('CSVDelimiter') || ';';
161
        $delimiter = "\t" if $delimiter eq 'tabulation';
161
        $delimiter = "\t" if $delimiter eq 'tabulation';
162
            my @rows;
162
            my @rows;
163
            foreach my $row (@loopresult) {
163
            foreach my $row (@loopresult) {
(-)a/reports/guided_reports.pl (-1 / +1 lines)
Lines 898-904 elsif ($phase eq 'Export'){ Link Here
898
                $content .= join("\t", map { $_ // '' } @$row) . "\n";
898
                $content .= join("\t", map { $_ // '' } @$row) . "\n";
899
            }
899
            }
900
        } else {
900
        } else {
901
            my $delimiter = C4::Context->preference('CSVDelimiter') || ',';
901
            my $delimiter = C4::Context->preference('CSVDelimiter') || ';';
902
            if ( $format eq 'csv' ) {
902
            if ( $format eq 'csv' ) {
903
                $delimiter = "\t" if $delimiter eq 'tabulation';
903
                $delimiter = "\t" if $delimiter eq 'tabulation';
904
                $type = 'application/csv';
904
                $type = 'application/csv';
(-)a/reports/orders_by_fund.pl (-1 / +1 lines)
Lines 209-215 else { Link Here
209
    $template->param(   budgetsloop   => \@{$budgetloop},
209
    $template->param(   budgetsloop   => \@{$budgetloop},
210
        outputFormatloop => \@outputFormats,
210
        outputFormatloop => \@outputFormats,
211
        delimiterloop => \@CSVdelimiters,
211
        delimiterloop => \@CSVdelimiters,
212
        delimiterPreference => C4::Context->preference('CSVDelimiter')
212
        delimiterPreference => C4::Context->preference('CSVDelimiter') || ';'
213
    );
213
    );
214
}
214
}
215
215
(-)a/t/Koha_Template_Plugin_Koha.t (-4 / +4 lines)
Lines 96-108 subtest "Koha::Template::Plugin::Koha::CSVDelimiter tests" => sub { Link Here
96
    my $plugin = Koha::Template::Plugin::Koha->new();
96
    my $plugin = Koha::Template::Plugin::Koha->new();
97
97
98
    t::lib::Mocks::mock_preference('CSVDelimiter', '');
98
    t::lib::Mocks::mock_preference('CSVDelimiter', '');
99
    is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is empty string");
99
    is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns semicolon when preference is empty string");
100
100
101
    t::lib::Mocks::mock_preference('CSVDelimiter', undef);
101
    t::lib::Mocks::mock_preference('CSVDelimiter', undef);
102
    is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is undefined");
102
    is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns semicolon when preference is undefined");
103
103
104
    t::lib::Mocks::mock_preference('CSVDelimiter', ';');
104
    t::lib::Mocks::mock_preference('CSVDelimiter', ',');
105
    is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns preference value when preference is not tabulation");
105
    is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns preference value when preference is not tabulation");
106
106
107
    t::lib::Mocks::mock_preference('CSVDelimiter', 'tabulation');
107
    t::lib::Mocks::mock_preference('CSVDelimiter', 'tabulation');
108
    is($plugin->CSVDelimiter(), "\t", "CSVDelimiter() returns \\t when preference is tabulation");
108
    is($plugin->CSVDelimiter(), "\t", "CSVDelimiter() returns \\t when preference is tabulation");
(-)a/tools/viewlog.pl (-2 / +1 lines)
Lines 227-233 if ($do_it) { Link Here
227
        # Printing to a csv file
227
        # Printing to a csv file
228
        my $content = q{};
228
        my $content = q{};
229
        if (@data) {
229
        if (@data) {
230
            my $delimiter = C4::Context->preference('CSVDelimiter') || ',';
230
            my $delimiter = C4::Context->preference('CSVDelimiter') || ';';
231
            $delimiter = "\t" if $delimiter eq 'tabulation';
231
            $delimiter = "\t" if $delimiter eq 'tabulation';
232
            my $csv = Text::CSV::Encoded->new( { encoding_out => 'utf8', sep_char => $delimiter } );
232
            my $csv = Text::CSV::Encoded->new( { encoding_out => 'utf8', sep_char => $delimiter } );
233
            $csv or die "Text::CSV::Encoded->new FAILED: " . Text::CSV::Encoded->error_diag();
233
            $csv or die "Text::CSV::Encoded->new FAILED: " . Text::CSV::Encoded->error_diag();
234
- 

Return to bug 28363