Lines 28-34
This script displays lost items.
Link Here
|
28 |
use Modern::Perl; |
28 |
use Modern::Perl; |
29 |
|
29 |
|
30 |
use CGI qw ( -utf8 ); |
30 |
use CGI qw ( -utf8 ); |
31 |
use Text::CSV_XS; |
31 |
use Text::CSV::Encoded; |
32 |
use C4::Auth; |
32 |
use C4::Auth; |
33 |
use C4::Output; |
33 |
use C4::Output; |
34 |
use C4::Biblio; |
34 |
use C4::Biblio; |
Lines 64-70
if ( $op eq 'export' ) {
Link Here
|
64 |
my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id ); |
64 |
my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id ); |
65 |
die "There is no valid csv profile given" unless $csv_profile; |
65 |
die "There is no valid csv profile given" unless $csv_profile; |
66 |
|
66 |
|
67 |
my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->csv_separator,'binary'=>1}); |
|
|
68 |
my $csv_profile_content = $csv_profile->content; |
67 |
my $csv_profile_content = $csv_profile->content; |
69 |
my ( @headers, @fields ); |
68 |
my ( @headers, @fields ); |
70 |
while ( $csv_profile_content =~ / |
69 |
while ( $csv_profile_content =~ / |
Lines 93-103
if ( $op eq 'export' ) {
Link Here
|
93 |
} |
92 |
} |
94 |
push @rows, \@row; |
93 |
push @rows, \@row; |
95 |
} |
94 |
} |
96 |
my $content = join( $csv_profile->csv_separator, @headers ) . "\n"; |
95 |
my $delimiter = $csv_profile->csv_separator; |
|
|
96 |
$delimiter = "\t" if $delimiter eq "\\t"; |
97 |
|
98 |
my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter}); |
99 |
$csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag(); |
100 |
$csv->combine(@headers); |
101 |
my $content .= Encode::decode('UTF-8', $csv->string()) . "\n"; |
97 |
for my $row ( @rows ) { |
102 |
for my $row ( @rows ) { |
98 |
$csv->combine(@$row); |
103 |
$csv->combine(@$row); |
99 |
my $string = $csv->string; |
104 |
$content .= $csv->string . "\n"; |
100 |
$content .= $string . "\n"; |
|
|
101 |
} |
105 |
} |
102 |
print $query->header( |
106 |
print $query->header( |
103 |
-type => 'text/csv', |
107 |
-type => 'text/csv', |
104 |
- |
|
|