summaryrefslogtreecommitdiff
path: root/src/temps.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-01 21:14:05 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-01 21:14:05 -0500
commit6b6ca6d4c70df0e4a3009ee093cf2f83ecee2675 (patch)
treed883948c90dd7d6dd096458a96c6b3e2b66b312a /src/temps.cc
parent48f024a42aa02f36220cf5e06ed005c65cc3fa76 (diff)
downloadfork-ledger-6b6ca6d4c70df0e4a3009ee093cf2f83ecee2675.tar.gz
fork-ledger-6b6ca6d4c70df0e4a3009ee093cf2f83ecee2675.tar.bz2
fork-ledger-6b6ca6d4c70df0e4a3009ee093cf2f83ecee2675.zip
Improved the way account temporaries are managed
Diffstat (limited to 'src/temps.cc')
-rw-r--r--src/temps.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/temps.cc b/src/temps.cc
index f2dee159..e44aaaa7 100644
--- a/src/temps.cc
+++ b/src/temps.cc
@@ -48,6 +48,11 @@ temporaries_t::~temporaries_t()
if (! post.account->has_flags(ACCOUNT_TEMP))
post.account->remove_post(&post);
}
+
+ foreach (account_t& acct, *acct_temps) {
+ if (! acct.has_flags(ACCOUNT_TEMP))
+ acct.remove_account(&acct);
+ }
}
}
@@ -120,6 +125,9 @@ account_t& temporaries_t::create_account(const string& name,
acct_temps->push_back(account_t(parent, name));
account_t& temp(acct_temps->back());
+ if (parent)
+ parent->add_account(&temp);
+
temp.add_flags(ACCOUNT_TEMP);
return temp;
}