X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCsvImport%2FBaseMulti.pm;h=ad84039943ae7e3a8dcd271d26679107b4bbfde4;hb=20392548f2e8ed92478542893df9852d6987e031;hp=973a4ae8e93fe6f8a0673e4c004301585670eace;hpb=8269a9775931a4d7f5e7a564fbf0a385bb5420ae;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport/BaseMulti.pm b/SL/Controller/CsvImport/BaseMulti.pm index 973a4ae8e..ad8403994 100644 --- a/SL/Controller/CsvImport/BaseMulti.pm +++ b/SL/Controller/CsvImport/BaseMulti.pm @@ -187,6 +187,18 @@ sub init_profile { eval "require " . $class; my %unwanted = map { ( $_ => 1 ) } (qw(itime mtime), map { $_->name } @{ $class->meta->primary_key_columns }); + + # TODO: exceptions for AccTransaction and Invoice wh + if ( $class =~ m/^SL::DB::AccTransaction/ ) { + my %unwanted_acc_trans = map { ( $_ => 1 ) } (qw(acc_trans_id trans_id cleared fx_transaction ob_transaction cb_transaction itime mtime chart_link tax_id description gldate memo source transdate), map { $_->name } @{ $class->meta->primary_key_columns }); + @unwanted{keys %unwanted_acc_trans} = values %unwanted_acc_trans; + }; + if ( $class =~ m/^SL::DB::Invoice/ ) { + # remove fields that aren't needed / shouldn't be set for ar transaction + my %unwanted_ar = map { ( $_ => 1 ) } (qw(closed currency currency_id datepaid dunning_config_id gldate invnumber_for_credit_note invoice marge_percent marge_total amount netamount paid shippingpoint shipto_id shipvia storno storno_id type cp_id), map { $_->name } @{ $class->meta->primary_key_columns }); + @unwanted{keys %unwanted_ar} = values %unwanted_ar; + }; + my %prof; $prof{datatype} = ''; for my $col ($class->meta->columns) { @@ -268,7 +280,7 @@ sub fix_field_lengths { my %field_lengths_by_ri = $self->field_lengths; foreach my $entry (@{ $self->controller->data }) { - next unless @{ $entry->{errors} }; + next unless defined $entry->{errors} && @{ $entry->{errors} }; my %field_lengths = %{ $field_lengths_by_ri{ $entry->{raw_data}->{datatype} } }; map { $entry->{object}->$_(substr($entry->{object}->$_, 0, $field_lengths{$_})) if $entry->{object}->$_ } keys %field_lengths; }