Bug 9892: Make export_borrowers.pl using the delimiter pref

The original concern of bug 9892 was that this borrowers export script
cannot handle tabulation to separate columns.

With this patch, the delimiter preference is used as separator for the
output, to be consistent with others scripts.

This should be highlighted on the release, it can produce change in
behaviors.

Test plan:
Confirm that the 'delimiter' pref is used for the output, but you are able
to overwrite it with the 'separator' parameter

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as expected, respect preference but is supeseeded by cmd line
No koha-qa errors

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2015-04-09 15:49:14 +02:00 committed by Tomas Cohen Arazi
parent 918c068e17
commit 6517e9c16d
1 changed files with 5 additions and 0 deletions

View File

@ -87,6 +87,11 @@ $query .= " ORDER BY borrowernumber";
my $sth = $dbh->prepare($query);
$sth->execute;
unless ( $separator ) {
$separator = C4::Context->preference('delimiter') || ',';
$separator = "\t" if ($separator eq 'tabulation');
}
my $csv = Text::CSV->new( { sep_char => $separator, binary => 1 } );
# If the user did not specify any field to export, we assume he wants them all