(related_transactions::flush): Handle the case where an auto_entry or

period_entry passes through the related_transactions handler.
This commit is contained in:
John Wiegley 2005-02-09 05:06:27 +00:00
parent 3b112af362
commit 46302362dd

29
walk.cc
View file

@ -210,22 +210,35 @@ void collapse_transactions::operator()(transaction_t& xact)
void related_transactions::flush() void related_transactions::flush()
{ {
if (transactions.size() > 0) if (transactions.size() > 0) {
for (transactions_list::iterator i = transactions.begin(); for (transactions_list::iterator i = transactions.begin();
i != transactions.end(); i != transactions.end();
i++) i++) {
for (transactions_list::iterator j = (*i)->entry->transactions.begin(); if ((*i)->entry) {
j != (*i)->entry->transactions.end(); for (transactions_list::iterator j = (*i)->entry->transactions.begin();
j++) { j != (*i)->entry->transactions.end();
transaction_xdata_t& xdata = transaction_xdata(**j); 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) && if (! (xdata.dflags & TRANSACTION_HANDLED) &&
(! (xdata.dflags & TRANSACTION_RECEIVED) ? (! (xdata.dflags & TRANSACTION_RECEIVED) ?
! ((*j)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) : ! ((*i)->flags & (TRANSACTION_AUTO | TRANSACTION_VIRTUAL)) :
also_matching)) { also_matching)) {
xdata.dflags |= TRANSACTION_HANDLED; xdata.dflags |= TRANSACTION_HANDLED;
item_handler<transaction_t>::operator()(**j); item_handler<transaction_t>::operator()(**i);
} }
} }
}
}
item_handler<transaction_t>::flush(); item_handler<transaction_t>::flush();
} }