From: Sven Schöling Date: Thu, 16 Jun 2016 15:34:57 +0000 (+0200) Subject: CsvImport Mapping: header mit helper parsen X-Git-Tag: release-3.4.1~42 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7459b01b23dccf173e35281db34313d9868a94d0;p=kivitendo-erp.git CsvImport Mapping: header mit helper parsen sonst gibt es wieder die gleichen Probleme mit UTF-BOM --- diff --git a/SL/Controller/CsvImport.pm b/SL/Controller/CsvImport.pm index e53917e01..99f51c93d 100644 --- a/SL/Controller/CsvImport.pm +++ b/SL/Controller/CsvImport.pm @@ -239,19 +239,13 @@ sub action_add_mapping_from_upload { return; } - my $csv = Text::CSV_XS->new({ - binary => 1, - sep_char => $self->profile->get('sep_char'), - quote_char => $self->profile->get('quote_char'), - escape_char => $self->profile->get('escape_char'), - }); - - my $header = $csv->getline($file->fh) or do { - $self->js - ->flash('error', t8('No header found')) - ->render; - return; - }; + my $csv = SL::Helper::Csv->new( + file => $file->file_name, + map { $_ => $self->profile->get($_) } qw(sep_char escape_char quote_char), + ); + + $csv->_open_file; + my $header = $csv->check_header; for my $field (@$header) { next if $self->mappings_for_profile->{$field};