Skip to content

Commit

Permalink
Bug 33285: Allow specifying the delimeter for runreport.pl
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit bad0d52)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>
  • Loading branch information
kidclamp authored and Jacobomara901 committed Apr 16, 2023
1 parent cb7496a commit 94077ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions misc/cronjobs/runreport.pl
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ =head1 SEE ALSO
my $quote = '"';
my $store_results = 0;
my $csv_header = 0;
my $csv_separator = "";

my $username = undef;
my $password = undef;
Expand All @@ -195,6 +196,7 @@ =head1 SEE ALSO
'man' => \$man,
'verbose' => \$verbose,
'format=s' => \$format,
'separator=s' => \$csv_separator,
'to=s' => \$to,
'from=s' => \$from,
'subject=s' => \$subject,
Expand All @@ -219,6 +221,14 @@ =head1 SEE ALSO
$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";
Expand Down

0 comments on commit 94077ab

Please sign in to comment.