Code-Vereinfachung: Unnötige Variable weglassen.
[kivitendo-erp.git] / SL / Helper / Csv / Dispatcher.pm
index 758981c..a744892 100644 (file)
@@ -59,7 +59,7 @@ sub _specs_by_line {
 
   # initialize lookup hash if not already done
   if ($self->_csv->is_multiplexed && ! defined $self->_row_spec ) {
-    $self->_row_spec({ pairwise { $a->{row_ident} => $b } @{ $self->_csv->profile }, @{ $self->_specs } });
+    $self->_row_spec({ pairwise { no warnings 'once'; $a->{row_ident} => $b } @{ $self->_csv->profile }, @{ $self->_specs } });
   }
 
   if ($self->_csv->is_multiplexed) {
@@ -108,12 +108,10 @@ sub parse_profile {
 
   my $profile;
   my $class;
-  my $header;
   my @specs;
 
   my $i = 0;
-  foreach my $h (@{ $self->_csv->header }) {
-    $header = $h;
+  foreach my $header (@{ $self->_csv->header }) {
     if ($self->_csv->profile) {
       $profile = $self->_csv->profile->[$i]->{profile};
       $class   = $self->_csv->profile->[$i]->{class};
@@ -128,6 +126,8 @@ sub parse_profile {
 
   $self->_specs(\@specs);
 
+  $self->_csv->_push_error($self->errors);
+
   return ! $self->errors;
 }
 
@@ -157,8 +157,6 @@ sub _parse_profile {
     }
   }
 
-  $self->_csv->_push_error($self->errors);
-
   return \@specs;
 }