Csv Import Helper: classenlose profile dürfen den Dispatcher nicht abschiessen.
[kivitendo-erp.git] / SL / Helper / Csv / Dispatcher.pm
index cbcae0d..be3fadd 100644 (file)
@@ -71,7 +71,15 @@ sub parse_profile {
 
   for my $col (@$header) {
     next unless $col;
-    push @specs, $self->make_spec($col, $profile->{$col} || $col);
+    if ($self->_csv->strict_profile) {
+      if (exists $profile->{$col}) {
+        push @specs, $self->make_spec($col, $profile->{$col});
+      } else {
+        $self->unknown_column($col, undef);
+      }
+    } else {
+      push @specs, $self->make_spec($col, $profile->{$col} || $col);
+    }
   }
 
   $self->_specs(\@specs);
@@ -85,6 +93,8 @@ sub make_spec {
   my $spec = { key => $col, steps => [] };
   my $cur_class = $self->_csv->class;
 
+  return unless $cur_class;
+
   for my $step_index ( split /\.(?!\d)/, $path ) {
     my ($step, $index) = split /\./, $step_index;
     if ($cur_class->can($step)) {