summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/account.cc15
-rw-r--r--src/account.h1
-rw-r--r--src/journal.cc1
-rw-r--r--src/textual.cc3
-rw-r--r--test/baseline/feat-balance_assert_split.test5
5 files changed, 25 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
diff --git a/src/account.h b/src/account.h
index 3ce93fba..d1377c39 100644
--- a/src/account.h
+++ b/src/account.h
@@ -139,6 +139,7 @@ public:
void add_post(post_t * post);
void add_deferred_post(const string& uuid, post_t * post);
+ void apply_deferred_posts();
bool remove_post(post_t * post);
posts_list::iterator posts_begin() {
diff --git a/src/journal.cc b/src/journal.cc
index 94a535d7..ea74cb66 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -399,6 +399,7 @@ bool journal_t::add_xact(xact_t * xact)
if (i != acct->deferred_posts->end()) {
foreach (post_t * rpost, (*i).second)
acct->add_post(rpost);
+ acct->deferred_posts->erase(i);
}
}
}
diff --git a/src/textual.cc b/src/textual.cc
index 6f8f0492..d02e2f79 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -1925,6 +1925,9 @@ std::size_t journal_t::read_textual(parse_context_stack_t& context_stack)
}
TRACE_STOP(parsing_total, 1);
+ // Apply any deferred postings at this time
+ master->apply_deferred_posts();
+
// These tracers were started in textual.cc
TRACE_FINISH(xact_text, 1);
TRACE_FINISH(xact_details, 1);
diff --git a/test/baseline/feat-balance_assert_split.test b/test/baseline/feat-balance_assert_split.test
index 7c2450b6..1640bf8b 100644
--- a/test/baseline/feat-balance_assert_split.test
+++ b/test/baseline/feat-balance_assert_split.test
@@ -22,6 +22,11 @@
Liabilities:MasterCard $150.00 = $0
<Assets:Checking>
+2012-01-04 Test
+ ; UUID: baz
+ Liabilities:MasterCard $150.00 = $0
+ <Assets:Checking>
+
;; b.dat
2012-01-01 Test