+ $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 {
+ my ($self, $entry) = @_;
+
+ my $object = $entry->{object};
+
+ # for each imported entry (line) we make a database call to find existing entries
+ # we don't use the init_by hash because we have to check several fields
+ # this means that we can't detect duplicates in the import file
+
+ if ( $object->amount ) {
+ # check for same
+ # * purpose
+ # * transdate
+ # * remote_account_number (may be empty for records of our own bank)
+ # * amount
+ my $num;
+ if ( $num = SL::DB::Manager::BankTransaction->get_all_count(query =>[ remote_account_number => $object->remote_account_number, transdate => $object->transdate, purpose => $object->purpose, amount => $object->amount] ) ) {
+ push(@{$entry->{errors}}, $::locale->text('Skipping due to existing bank transaction in database'));
+ };
+ } else {
+ push(@{$entry->{errors}}, $::locale->text('Skipping because transfer amount is empty.'));
+ };
+}
+
+sub _displayable_columns {
+ (
+ { name => 'local_bank_code', description => $::locale->text('Own bank code') },
+ { name => 'local_account_number', description => $::locale->text('Own bank account number or IBAN') },
+ { name => 'local_bank_account_id', description => $::locale->text('ID of own bank account') },
+ { name => 'remote_bank_code', description => $::locale->text('Bank code of the goal/source') },
+ { name => 'remote_account_number', description => $::locale->text('Account number of the goal/source') },
+ { name => 'transdate', description => $::locale->text('Date of transaction') },
+ { name => 'valutadate', description => $::locale->text('Valuta date') },
+ { name => 'amount', description => $::locale->text('Amount') },
+ { name => 'currency', description => $::locale->text('Currency') },
+ { name => 'currency_id', description => $::locale->text('Currency (database ID)') },
+ { name => 'remote_name', description => $::locale->text('Name of the goal/source (if field names remote_name and remote_name_1 exist they will be combined into field "remote_name")') },
+ { name => 'purpose', description => $::locale->text('Purpose (if field names purpose, purpose1, purpose2 ... exist they will all combined into the field "purpose")') }
+ );