From a56a1db66294c06c7b9d582f694538a0cb473abf Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 2 Feb 2010 16:25:46 -0500 Subject: When creating temporary accounts, transfer flags --- src/filters.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/filters.cc') diff --git a/src/filters.cc b/src/filters.cc index 0084fac7..aa532ab6 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -793,12 +793,18 @@ void transfer_details::operator()(post_t& post) break; case SET_ACCOUNT: { - std::list account_names; + account_t * prev_account = temp.account; temp.account->remove_post(&temp); + + std::list 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()); break; } -- cgit v1.2.3 From 428a2b40191eb1c4fc7f8998e17e551dab9820a9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 4 Feb 2010 04:12:19 -0500 Subject: Improved the behavior of pivot reports --- src/filters.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/filters.cc') 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 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 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; } -- cgit v1.2.3