diff options
author | John Wiegley <johnw@newartisans.com> | 2005-02-09 05:06:27 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:40:54 -0400 |
commit | 46302362dda509bb7c6f10f5ea059ba51d1f0aba (patch) | |
tree | 65154daeee18b6773f21e7993fa91677122328a9 | |
parent | 3b112af3624b4ce6c4ffe3c0ec3fcba978f86217 (diff) | |
download | fork-ledger-46302362dda509bb7c6f10f5ea059ba51d1f0aba.tar.gz fork-ledger-46302362dda509bb7c6f10f5ea059ba51d1f0aba.tar.bz2 fork-ledger-46302362dda509bb7c6f10f5ea059ba51d1f0aba.zip |
(related_transactions::flush): Handle the case where an auto_entry or
period_entry passes through the related_transactions handler.
-rw-r--r-- | walk.cc | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -210,22 +210,35 @@ void collapse_transactions::operator()(transaction_t& xact) void related_transactions::flush() { - if (transactions.size() > 0) + if (transactions.size() > 0) { for (transactions_list::iterator i = transactions.begin(); i != transactions.end(); - i++) - for (transactions_list::iterator j = (*i)->entry->transactions.begin(); - j != (*i)->entry->transactions.end(); - j++) { - transaction_xdata_t& xdata = transaction_xdata(**j); + i++) { + if ((*i)->entry) { + for (transactions_list::iterator j = (*i)->entry->transactions.begin(); + j != (*i)->entry->transactions.end(); + j++) { + transaction_xdata_t& xdata = transaction_xdata(**j); + if (! (xdata.dflags & TRANSACTION_HANDLED) && + (! (xdata.dflags & TRANSACTION_RECEIVED) ? + ! ((*j)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : + also_matching)) { + xdata.dflags |= TRANSACTION_HANDLED; + item_handler<transaction_t>::operator()(**j); + } + } + } else { + transaction_xdata_t& xdata = transaction_xdata(**i); if (! (xdata.dflags & TRANSACTION_HANDLED) && (! (xdata.dflags & TRANSACTION_RECEIVED) ? - ! ((*j)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : + ! ((*i)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : also_matching)) { xdata.dflags |= TRANSACTION_HANDLED; - item_handler<transaction_t>::operator()(**j); + item_handler<transaction_t>::operator()(**i); } } + } + } item_handler<transaction_t>::flush(); } |