my $account = $homebank->find_account_by_key($transaction->{account});
my $amount = $transaction->{amount};
my $status = $STATUS_SYMBOLS{$transaction->{status} || ''} || '';
- my $paymode = $transaction->{paymode} || ''; # internaltransfer
my $memo = $transaction->{wording} || '';
my $payee = $homebank->find_payee_by_key($transaction->{payee});
my $tags = _split_tags($transaction->{tags});
tags => $tags,
};
- if ($paymode eq 'internaltransfer') {
+ if ($transaction->{dst_account}) { # is an internal transfer
my $paired_transaction = $homebank->find_transaction_transfer_pair($transaction);
my $dst_account = $homebank->find_account_by_key($transaction->{dst_account});
my $self = shift;
my $transaction = shift;
- return if $transaction->{paymode} ne 'internaltransfer';
+ return if !$transaction->{dst_account};
my $transfer_key = $transaction->{transfer_key};
my @candidates;
for my $t (@{$self->transactions}) {
- next if $t->{paymode} ne 'internaltransfer';
+ next if !$t->{dst_account};
next if $t->{account} != $transaction->{dst_account};
next if $t->{dst_account} != $transaction->{account};
next if $t->{amount} != -$transaction->{amount};
# sort the candidates so we can pick the nearest one by date
my @ordered_candidates =
- map { $_->[1] }
+ map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
- map { [abs($transaction_day - _ymd_to_julian($_->{date})), $_] } @candidates;
+ map { [abs($transaction_day - _ymd_to_julian($_->{date})), $_] } @candidates;
if (my $winner = $ordered_candidates[0]) {
my $key1 = $transfer_key || '[no key]';