Lines 9-16
BEGIN {
Link Here
|
9 |
eval { require "$FindBin::Bin/../kohalib.pl" }; |
9 |
eval { require "$FindBin::Bin/../kohalib.pl" }; |
10 |
} |
10 |
} |
11 |
|
11 |
|
12 |
use |
12 |
use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy |
13 |
CGI; # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy |
|
|
14 |
use C4::Context; |
13 |
use C4::Context; |
15 |
use C4::Dates; |
14 |
use C4::Dates; |
16 |
use C4::Debug; |
15 |
use C4::Debug; |
Lines 180-186
sub generate_html {
Link Here
|
180 |
messages => $messages, |
179 |
messages => $messages, |
181 |
); |
180 |
); |
182 |
|
181 |
|
183 |
open my $OUTPUT, '>', $filepath |
182 |
open my $OUTPUT, '>encoding(utf-8)', $filepath |
184 |
or die "Could not open $filepath: $!"; |
183 |
or die "Could not open $filepath: $!"; |
185 |
print $OUTPUT $template->output; |
184 |
print $OUTPUT $template->output; |
186 |
close $OUTPUT; |
185 |
close $OUTPUT; |
Lines 191-197
sub generate_csv {
Link Here
|
191 |
my $messages = $params->{messages}; |
190 |
my $messages = $params->{messages}; |
192 |
my $filepath = $params->{filepath}; |
191 |
my $filepath = $params->{filepath}; |
193 |
|
192 |
|
194 |
open my $OUTPUT, '>', $filepath |
193 |
open my $OUTPUT, '>encoding(utf-8)', $filepath |
195 |
or die "Could not open $filepath: $!"; |
194 |
or die "Could not open $filepath: $!"; |
196 |
my ( @csv_lines, $headers ); |
195 |
my ( @csv_lines, $headers ); |
197 |
foreach my $message ( @$messages ) { |
196 |
foreach my $message ( @$messages ) { |
Lines 201-213
sub generate_csv {
Link Here
|
201 |
# We don't have headers, get them |
200 |
# We don't have headers, get them |
202 |
unless ( $headers ) { |
201 |
unless ( $headers ) { |
203 |
$headers = $lines[0]; |
202 |
$headers = $lines[0]; |
204 |
say $OUTPUT Encode::encode( 'UTF8', $headers ); |
203 |
say $OUTPUT $headers; |
205 |
} |
204 |
} |
206 |
|
205 |
|
207 |
shift @lines; |
206 |
shift @lines; |
208 |
for my $line ( @lines ) { |
207 |
for my $line ( @lines ) { |
209 |
next if $line =~ /^\s$/; |
208 |
next if $line =~ /^\s$/; |
210 |
say $OUTPUT Encode::encode( 'UTF8', $line ); |
209 |
say $OUTPUT $line; |
211 |
} |
210 |
} |
212 |
} |
211 |
} |
213 |
} |
212 |
} |
Lines 250-260
sub generate_ods {
Link Here
|
250 |
shift @lines; # remove headers |
249 |
shift @lines; # remove headers |
251 |
my $i = 1; |
250 |
my $i = 1; |
252 |
for my $line ( @lines ) { |
251 |
for my $line ( @lines ) { |
253 |
my $row_data = split $delimiter, $line; |
252 |
my @row_data = split $delimiter, $line; |
254 |
my $row = $doc->getRow( $table, $i ); |
253 |
my $row = $doc->getRow( $table, $i ); |
255 |
# Note scalar(@$row_data) should be equal to $nb_cols |
254 |
# Note scalar(@$row_data) should be equal to $nb_cols |
256 |
for ( my $j = 0 ; $j < scalar(@$row_data) ; $j++ ) { |
255 |
for ( my $j = 0 ; $j < scalar(@row_data) ; $j++ ) { |
257 |
my $value = Encode::encode( 'UTF8', $row_data->[$j] ); |
256 |
my $value = Encode::encode( 'UTF8', $row_data[$j] ); |
258 |
$doc->cellValue( $row, $j, $value ); |
257 |
$doc->cellValue( $row, $j, $value ); |
259 |
} |
258 |
} |
260 |
$i++; |
259 |
$i++; |
261 |
- |
|
|