Improved the behavior of pivot reports

This commit is contained in:
John Wiegley 2010-02-04 04:12:19 -05:00
parent 7533cf7ddb
commit 428a2b4019

View file

@ -793,11 +793,17 @@ void transfer_details::operator()(post_t& post)
break; break;
case SET_ACCOUNT: { case SET_ACCOUNT: {
string account_name = substitute.to_string();
if (! account_name.empty() &&
account_name[account_name.length() - 1] != ':') {
account_t * prev_account = temp.account; account_t * prev_account = temp.account;
temp.account->remove_post(&temp); temp.account->remove_post(&temp);
account_name += ':';
account_name += prev_account->fullname();
std::list<string> account_names; std::list<string> account_names;
split_string(substitute.to_string(), ':', account_names); split_string(account_name, ':', account_names);
temp.account = create_temp_account_from_path(account_names, temps, temp.account = create_temp_account_from_path(account_names, temps,
xact.journal->master); xact.journal->master);
temp.account->add_post(&temp); temp.account->add_post(&temp);
@ -805,6 +811,7 @@ void transfer_details::operator()(post_t& post)
temp.account->add_flags(prev_account->flags()); temp.account->add_flags(prev_account->flags());
if (prev_account->has_xdata()) if (prev_account->has_xdata())
temp.account->xdata().add_flags(prev_account->xdata().flags()); temp.account->xdata().add_flags(prev_account->xdata().flags());
}
break; break;
} }