diff options
author | Alan Pearce | 2015-04-07 14:21:44 +0100 |
---|---|---|
committer | Alan Pearce | 2015-04-07 14:21:44 +0100 |
commit | 14efbeb7469091725791458a8282c3bc884ca28e (patch) | |
tree | ce88628d409222fc8dc73664aa26d7cd6bf82784 | |
parent | 8599153dd0a954cbf45f814973457576b23f8a89 (diff) | |
download | ynab-ledger-14efbeb7469091725791458a8282c3bc884ca28e.tar.xz ynab-ledger-14efbeb7469091725791458a8282c3bc884ca28e.zip |
Parse transfers within split transactions
-rw-r--r-- | src/Command/ConvertCommand.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Command/ConvertCommand.php b/src/Command/ConvertCommand.php index 1a8aac9..306e9b4 100644 --- a/src/Command/ConvertCommand.php +++ b/src/Command/ConvertCommand.php | |||
@@ -147,7 +147,9 @@ function toLedger (Generator $transactions) { | |||
147 | 147 | ||
148 | do { | 148 | do { |
149 | $target = new LedgerPosting; | 149 | $target = new LedgerPosting; |
150 | if ($txn->category[0] == 'Income') { | 150 | if (empty($txn->category)) { |
151 | $target->account = getAccount(explode(' : ', explode(' / ', $txn->payee, 2)[1])[1], $txn); | ||
152 | } elseif ($txn->category[0] == 'Income') { | ||
151 | $target->account = $txn->category; | 153 | $target->account = $txn->category; |
152 | } else { | 154 | } else { |
153 | $target->account = array_merge(['Expenses'], $txn->category); | 155 | $target->account = array_merge(['Expenses'], $txn->category); |
@@ -230,7 +232,7 @@ function readRegister (SplFileObject $registerFile, NumberFormatter $fmt) { | |||
230 | $txn->account = $row[0]; | 232 | $txn->account = $row[0]; |
231 | $txn->date = $convertDate($row[3])->setTime(0, 0, 0); | 233 | $txn->date = $convertDate($row[3])->setTime(0, 0, 0); |
232 | $txn->payee = $row[4]; | 234 | $txn->payee = $row[4]; |
233 | $txn->category = array_map('trim', explode(':', $row[5])); | 235 | $txn->category = array_filter(array_map('trim', explode(':', $row[5]))); |
234 | // if (!in_array($row[6], $txn->category, true)) { | 236 | // if (!in_array($row[6], $txn->category, true)) { |
235 | // array_unshift($txn->category, $row[6]); | 237 | // array_unshift($txn->category, $row[6]); |
236 | // } | 238 | // } |