summaryrefslogtreecommitdiff
path: root/src/iterators.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-13 00:04:31 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-13 00:04:31 -0500
commitdcd83203e6bcc9e861e784c0c1e1dff14b1cf930 (patch)
tree10371700e2dc889a13331bcf5c15314f67576191 /src/iterators.cc
parent59cbcf703c407833e4bdb07aa53a8ad6c20c292c (diff)
downloadfork-ledger-dcd83203e6bcc9e861e784c0c1e1dff14b1cf930.tar.gz
fork-ledger-dcd83203e6bcc9e861e784c0c1e1dff14b1cf930.tar.bz2
fork-ledger-dcd83203e6bcc9e861e784c0c1e1dff14b1cf930.zip
posts_commodities_iterator wasn't setting the journal
Diffstat (limited to 'src/iterators.cc')
-rw-r--r--src/iterators.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/iterators.cc b/src/iterators.cc
index b994d59a..8ca5922b 100644
--- a/src/iterators.cc
+++ b/src/iterators.cc
@@ -76,16 +76,19 @@ void journal_posts_iterator::increment()
}
namespace {
- struct create_price_xact {
+ struct create_price_xact
+ {
+ journal_t& journal;
account_t * account;
temporaries_t& temps;
xacts_list& xact_temps;
std::map<string, xact_t *> xacts_by_commodity;
- create_price_xact(account_t * _account, temporaries_t& _temps,
- xacts_list& _xact_temps)
- : account(_account), temps(_temps), xact_temps(_xact_temps) {}
+ create_price_xact(journal_t& _journal, account_t * _account,
+ temporaries_t& _temps, xacts_list& _xact_temps)
+ : journal(_journal), account(_account), temps(_temps),
+ xact_temps(_xact_temps) {}
void operator()(datetime_t& date, const amount_t& price) {
xact_t * xact;
@@ -102,6 +105,7 @@ namespace {
xact->_date = date.date();
xacts_by_commodity.insert
(std::pair<string, xact_t *>(symbol, xact));
+ xact->journal = &journal;
}
bool post_already_exists = false;
@@ -139,7 +143,7 @@ void posts_commodities_iterator::reset(journal_t& journal)
foreach (commodity_t * comm, commodities)
comm->map_prices
- (create_price_xact(journal.master->find_account(comm->symbol()),
+ (create_price_xact(journal, journal.master->find_account(comm->symbol()),
temps, xact_temps));
xacts.reset(xact_temps.begin(), xact_temps.end());