summaryrefslogtreecommitdiff
path: root/src/account.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2014-04-14 11:08:26 -0500
committerJohn Wiegley <johnw@newartisans.com>2014-04-14 11:08:26 -0500
commit0d23e3d4f6ea4e9ec9a70211abb892383b80188e (patch)
tree1c2d81ce53dd00c6c06a96ea9d41984fd7e3b385 /src/account.cc
parent57870f1be87383bf1bc3d7d9a06e411546fb6801 (diff)
downloadfork-ledger-0d23e3d4f6ea4e9ec9a70211abb892383b80188e.tar.gz
fork-ledger-0d23e3d4f6ea4e9ec9a70211abb892383b80188e.tar.bz2
fork-ledger-0d23e3d4f6ea4e9ec9a70211abb892383b80188e.zip
Apply any outstanding deferred postings at the end of parsing
Diffstat (limited to 'src/account.cc')
-rw-r--r--src/account.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/account.cc b/src/account.cc
index a702cf11..216b15bd 100644
--- a/src/account.cc
+++ b/src/account.cc
@@ -154,6 +154,21 @@ void account_t::add_deferred_post(const string& uuid, post_t * post)
}
}
+void account_t::apply_deferred_posts()
+{
+ if (deferred_posts) {
+ foreach (deferred_posts_map_t::value_type& pair, *deferred_posts) {
+ foreach (post_t * post, pair.second)
+ post->account->add_post(post);
+ }
+ deferred_posts = none;
+ }
+
+ // Also apply in child accounts
+ foreach (const accounts_map::value_type& pair, accounts)
+ pair.second->apply_deferred_posts();
+}
+
bool account_t::remove_post(post_t * post)
{
// It's possible that 'post' wasn't yet in this account, but try to