diff options
author | Craig Earls <enderw88@gmail.com> | 2013-03-09 12:27:08 -0500 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-03-09 12:27:08 -0500 |
commit | ca99c0de03432393aa6576244005c9ad8806fa29 (patch) | |
tree | bf0dd4586adb4b7df1adad8a5eff5d2bca36f4e3 /src/account.cc | |
parent | 4c608cccd0c6f06f403882dcca36cb62a40178a2 (diff) | |
parent | bfe360d4c992caf2e7da09ab058599c0404f1348 (diff) | |
download | fork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.tar.gz fork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.tar.bz2 fork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.zip |
Merge branch 'next' into ledger-mode-automatic-transactions
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/account.cc b/src/account.cc index 7dcd5faa..c3fc80f1 100644 --- a/src/account.cc +++ b/src/account.cc @@ -692,12 +692,10 @@ void account_t::xdata_t::details_t::update(post_t& post, } } -void put_account(property_tree::ptree& pt, const account_t& acct, +void put_account(property_tree::ptree& st, const account_t& acct, function<bool(const account_t&)> pred) { if (pred(acct)) { - property_tree::ptree& st(pt.put("account", "")); - std::ostringstream buf; buf.width(sizeof(unsigned long) * 2); buf.fill('0'); @@ -709,18 +707,15 @@ void put_account(property_tree::ptree& pt, const account_t& acct, st.put("fullname", acct.fullname()); value_t total = acct.amount(); - if (! total.is_null()) { - property_tree::ptree& t(st.put("account-amount", "")); - put_value(t, total); - } + if (! total.is_null()) + put_value(st.put("account-amount", ""), total); + total = acct.total(); - if (! total.is_null()) { - property_tree::ptree& t(st.put("account-total", "")); - put_value(t, total); - } + if (! total.is_null()) + put_value(st.put("account-total", ""), total); foreach (const accounts_map::value_type& pair, acct.accounts) - put_account(st, *pair.second, pred); + put_account(st.add("account", ""), *pair.second, pred); } } |