From 44561c1c1d233d9432de319a71b44a3e05275d49 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 24 Mar 2006 01:41:22 +0000 Subject: Further refinement of commodity lot information. --- walk.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'walk.cc') diff --git a/walk.cc b/walk.cc index 3a8ce640..32c165c2 100644 --- a/walk.cc +++ b/walk.cc @@ -528,13 +528,40 @@ void set_comm_as_payee::operator()(transaction_t& xact) entry_t& entry = entry_temps.back(); entry._date = xact.date(); entry.code = xact.entry->code; - entry.payee = xact.amount.commodity().symbol(); + + if (xact.amount.commodity()) + entry.payee = xact.amount.commodity().symbol(); + else + entry.payee = ""; xact_temps.push_back(xact); transaction_t& temp = xact_temps.back(); temp.entry = &entry; temp.state = xact.state; temp.flags |= TRANSACTION_BULK_ALLOC; + + entry.add_transaction(&temp); + + item_handler::operator()(temp); +} + +void set_code_as_payee::operator()(transaction_t& xact) +{ + entry_temps.push_back(*xact.entry); + entry_t& entry = entry_temps.back(); + entry._date = xact.date(); + + if (! xact.entry->code.empty()) + entry.payee = xact.entry->code; + else + entry.payee = ""; + + xact_temps.push_back(xact); + transaction_t& temp = xact_temps.back(); + temp.entry = &entry; + temp.state = xact.state; + temp.flags |= TRANSACTION_BULK_ALLOC; + entry.add_transaction(&temp); item_handler::operator()(temp); -- cgit v1.2.3