X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCsvImport%2FBankTransaction.pm;h=5be896860262ea6aa83e2245273e125e52f5b1ef;hb=09372651092644b1b852b8fea775003d92e2d08c;hp=76e9020afb59a5e3722690a98988e6c4695c2679;hpb=15f58ff3dfd79651a95535b53f864ea0e8cb6620;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport/BankTransaction.pm b/SL/Controller/CsvImport/BankTransaction.pm index 76e9020af..5be896860 100644 --- a/SL/Controller/CsvImport/BankTransaction.pm +++ b/SL/Controller/CsvImport/BankTransaction.pm @@ -15,6 +15,15 @@ use Rose::Object::MakeMethods::Generic 'scalar --get_set_init' => [ qw(bank_accounts_by) ], ); +sub set_profile_defaults { + my ($self) = @_; + + $self->controller->profile->_set_defaults( + charset => 'UTF8', # override charset from defaults + update_policy => 'skip', + ); +}; + sub init_class { my ($self) = @_; $self->class('SL::DB::BankTransaction'); @@ -47,6 +56,7 @@ sub check_objects { } $self->add_info_columns({ header => $::locale->text('Bank account'), method => 'local_bank_name' }); + $self->add_raw_data_columns("currency", "currency_id") if grep { /^currency(?:_id)?$/ } @{ $self->csv->header }; } sub check_existing { @@ -99,9 +109,9 @@ sub check_bank_account { my $object = $entry->{object}; - # Check whether or not local_bank_account ID exists and is valid. + # import via id: check whether or not local_bank_account ID exists and is valid. if ($object->local_bank_account_id && !$self->bank_accounts_by->{id}->{ $object->local_bank_account_id }) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid local bank account'); + push @{ $entry->{errors} }, $::locale->text('Error: unknown local bank account id'); return 0; } @@ -109,11 +119,11 @@ sub check_bank_account { if ($object->local_bank_account_id && $entry->{raw_data}->{local_account_number}) { my $bank_account = $self->bank_accounts_by->{id}->{ $object->local_bank_account_id }; if ($bank_account->account_number ne $entry->{raw_data}->{local_account_number}) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid local bank account'); + push @{ $entry->{errors} }, $::locale->text('Error: local bank account id doesn\'t match local bank account number'); return 0; } if ($entry->{raw_data}->{local_bank_code} && $entry->{raw_data}->{local_bank_code} ne $bank_account->bank_code) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid local bank account'); + push @{ $entry->{errors} }, $::locale->text('Error: local bank account id doesn\'t match local bank code'); return 0; } @@ -127,11 +137,11 @@ sub check_bank_account { $bank_account = $self->bank_accounts_by->{iban}->{ $entry->{raw_data}->{local_account_number} }; }; if (!$bank_account) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid local bank account'); + push @{ $entry->{errors} }, $::locale->text('Error: unknown local bank account') . ": " . $entry->{raw_data}->{local_account_number}; return 0; } if ($entry->{raw_data}->{local_bank_code} && $entry->{raw_data}->{local_bank_code} ne $bank_account->bank_code) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid local bank account'); + push @{ $entry->{errors} }, $::locale->text('Error: Found local bank account number but local bank code doesn\'t match') . ": " . $entry->{raw_data}->{local_bank_code}; return 0; }