diff options
author | John Wiegley <johnw@newartisans.com> | 2010-02-04 04:12:19 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-02-04 04:12:19 -0500 |
commit | 428a2b40191eb1c4fc7f8998e17e551dab9820a9 (patch) | |
tree | b113ac15d139615a04d1fd607633bc703687e137 /src/filters.cc | |
parent | 7533cf7ddbd758a4c8ecb780d6eae1d38004b780 (diff) | |
download | fork-ledger-428a2b40191eb1c4fc7f8998e17e551dab9820a9.tar.gz fork-ledger-428a2b40191eb1c4fc7f8998e17e551dab9820a9.tar.bz2 fork-ledger-428a2b40191eb1c4fc7f8998e17e551dab9820a9.zip |
Improved the behavior of pivot reports
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/filters.cc b/src/filters.cc index aa532ab6..2926eb08 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -793,18 +793,25 @@ void transfer_details::operator()(post_t& post) break; case SET_ACCOUNT: { - account_t * prev_account = temp.account; - temp.account->remove_post(&temp); - - std::list<string> account_names; - split_string(substitute.to_string(), ':', account_names); - temp.account = create_temp_account_from_path(account_names, temps, - xact.journal->master); - temp.account->add_post(&temp); - - temp.account->add_flags(prev_account->flags()); - if (prev_account->has_xdata()) - temp.account->xdata().add_flags(prev_account->xdata().flags()); + string account_name = substitute.to_string(); + if (! account_name.empty() && + account_name[account_name.length() - 1] != ':') { + account_t * prev_account = temp.account; + temp.account->remove_post(&temp); + + account_name += ':'; + account_name += prev_account->fullname(); + + std::list<string> account_names; + split_string(account_name, ':', account_names); + temp.account = create_temp_account_from_path(account_names, temps, + xact.journal->master); + temp.account->add_post(&temp); + + temp.account->add_flags(prev_account->flags()); + if (prev_account->has_xdata()) + temp.account->xdata().add_flags(prev_account->xdata().flags()); + } break; } |