Interpolate uses of $account in automated postings

Fixes 5CB52887-408E-48F0-8798-3C640D0295B3
This commit is contained in:
John Wiegley 2010-05-22 14:49:46 -04:00
parent 68056c1948
commit a596727d3d

View file

@ -716,8 +716,14 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
account_t * account = post->account;
string fullname = account->fullname();
assert(! fullname.empty());
if (fullname == "$account" || fullname == "@account")
account = initial_post->account;
if (contains(fullname, "$account")) {
fullname = regex_replace(fullname, regex("\\$account\\>"),
initial_post->account->fullname());
while (account->parent)
account = account->parent;
account = account->find_account(fullname);
}
// Copy over details so that the resulting post is a mirror of
// the automated xact's one.