|
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 184-190
sub generate_html {
Link Here
|
| 184 |
messages => $messages, |
183 |
messages => $messages, |
| 185 |
); |
184 |
); |
| 186 |
|
185 |
|
| 187 |
open my $OUTPUT, '>', $filepath |
186 |
open my $OUTPUT, '>encoding(utf-8)', $filepath |
| 188 |
or die "Could not open $filepath: $!"; |
187 |
or die "Could not open $filepath: $!"; |
| 189 |
print $OUTPUT $template->output; |
188 |
print $OUTPUT $template->output; |
| 190 |
close $OUTPUT; |
189 |
close $OUTPUT; |
|
Lines 195-201
sub generate_csv {
Link Here
|
| 195 |
my $messages = $params->{messages}; |
194 |
my $messages = $params->{messages}; |
| 196 |
my $filepath = $params->{filepath}; |
195 |
my $filepath = $params->{filepath}; |
| 197 |
|
196 |
|
| 198 |
open my $OUTPUT, '>', $filepath |
197 |
open my $OUTPUT, '>encoding(utf-8)', $filepath |
| 199 |
or die "Could not open $filepath: $!"; |
198 |
or die "Could not open $filepath: $!"; |
| 200 |
my ( @csv_lines, $headers ); |
199 |
my ( @csv_lines, $headers ); |
| 201 |
foreach my $message ( @$messages ) { |
200 |
foreach my $message ( @$messages ) { |
|
Lines 205-217
sub generate_csv {
Link Here
|
| 205 |
# We don't have headers, get them |
204 |
# We don't have headers, get them |
| 206 |
unless ( $headers ) { |
205 |
unless ( $headers ) { |
| 207 |
$headers = $lines[0]; |
206 |
$headers = $lines[0]; |
| 208 |
say $OUTPUT Encode::encode( 'UTF8', $headers ); |
207 |
say $OUTPUT $headers; |
| 209 |
} |
208 |
} |
| 210 |
|
209 |
|
| 211 |
shift @lines; |
210 |
shift @lines; |
| 212 |
for my $line ( @lines ) { |
211 |
for my $line ( @lines ) { |
| 213 |
next if $line =~ /^\s$/; |
212 |
next if $line =~ /^\s$/; |
| 214 |
say $OUTPUT Encode::encode( 'UTF8', $line ); |
213 |
say $OUTPUT $line; |
| 215 |
} |
214 |
} |
| 216 |
} |
215 |
} |
| 217 |
} |
216 |
} |
|
Lines 254-264
sub generate_ods {
Link Here
|
| 254 |
shift @lines; # remove headers |
253 |
shift @lines; # remove headers |
| 255 |
my $i = 1; |
254 |
my $i = 1; |
| 256 |
for my $line ( @lines ) { |
255 |
for my $line ( @lines ) { |
| 257 |
my $row_data = split $delimiter, $line; |
256 |
my @row_data = split $delimiter, $line; |
| 258 |
my $row = $doc->getRow( $table, $i ); |
257 |
my $row = $doc->getRow( $table, $i ); |
| 259 |
# Note scalar(@$row_data) should be equal to $nb_cols |
258 |
# Note scalar(@$row_data) should be equal to $nb_cols |
| 260 |
for ( my $j = 0 ; $j < scalar(@$row_data) ; $j++ ) { |
259 |
for ( my $j = 0 ; $j < scalar(@row_data) ; $j++ ) { |
| 261 |
my $value = Encode::encode( 'UTF8', $row_data->[$j] ); |
260 |
my $value = Encode::encode( 'UTF8', $row_data[$j] ); |
| 262 |
$doc->cellValue( $row, $j, $value ); |
261 |
$doc->cellValue( $row, $j, $value ); |
| 263 |
} |
262 |
} |
| 264 |
$i++; |
263 |
$i++; |
| 265 |
- |
|
|