Artikelimport bisher
[kivitendo-erp.git] / SL / Controller / CsvImport / Base.pm
index e854291..3d8dcea 100644 (file)
@@ -33,6 +33,7 @@ sub run {
 
   my $headers         = { headers => [ grep { $profile->{$_} } @{ $self->csv->header } ] };
   $headers->{methods} = [ map { $profile->{$_} } @{ $headers->{headers} } ];
+  $headers->{used}    = { map { ($_ => 1) }      @{ $headers->{headers} } };
   $self->controller->headers($headers);
 
   # my @data;
@@ -46,6 +47,18 @@ sub run {
   $self->fix_field_lenghts;
 }
 
+sub add_columns {
+  my ($self, @columns) = @_;
+
+  my $h = $self->controller->headers;
+
+  foreach my $column (grep { !$h->{used}->{$_} } @columns) {
+    $h->{used}->{$column} = 1;
+    push @{ $h->{methods} }, $column;
+    push @{ $h->{headers} }, $column;
+  }
+}
+
 sub init_profile {
   my ($self) = @_;