From 7459b01b23dccf173e35281db34313d9868a94d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 16 Jun 2016 17:34:57 +0200 Subject: [PATCH] CsvImport Mapping: header mit helper parsen sonst gibt es wieder die gleichen Probleme mit UTF-BOM --- SL/Controller/CsvImport.pm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) 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}; -- 2.20.1