Bug 33285: Allow specifying the delimeter for runreport.pl
To test: 1 - Write a report in koha 2 - perl misc/cronjobs/runreport.pl --format csv 1 (or correct report number) 3 - Note you get commas 4 - Apply patch 5 - Repeat #2 - no change 6 - perl misc/cronjobs/runreport.pl --format csv --separator "|" 1 7 - Now it is pipe delimited 8 - perl misc/cronjobs/runreport.pl --format tsv --separator "|" 1 9 - Error is reported, you cannot set separator unless csv 10 - Try other separators Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
92e3793eb8
commit
bad0d52245
1 changed files with 10 additions and 0 deletions
|
@ -183,6 +183,7 @@ my $separator = ',';
|
|||
my $quote = '"';
|
||||
my $store_results = 0;
|
||||
my $csv_header = 0;
|
||||
my $csv_separator = "";
|
||||
|
||||
my $username = undef;
|
||||
my $password = undef;
|
||||
|
@ -195,6 +196,7 @@ GetOptions(
|
|||
'man' => \$man,
|
||||
'verbose' => \$verbose,
|
||||
'format=s' => \$format,
|
||||
'separator=s' => \$csv_separator,
|
||||
'to=s' => \$to,
|
||||
'from=s' => \$from,
|
||||
'subject=s' => \$subject,
|
||||
|
@ -219,6 +221,14 @@ unless ($format) {
|
|||
$format = 'text';
|
||||
}
|
||||
|
||||
if( $csv_separator ){
|
||||
if( $format eq 'csv' ) {
|
||||
$separator = "$csv_separator";
|
||||
} else {
|
||||
print STDERR "Cannot specify separator if not using CSV format\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($format eq 'tsv' || $format eq 'text') {
|
||||
$format = 'csv';
|
||||
$separator = "\t";
|
||||
|
|
Loading…
Reference in a new issue