From a596727d3d2cef76e7347f3695d5d04067b24d19 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 22 May 2010 14:49:46 -0400 Subject: Interpolate uses of $account in automated postings Fixes 5CB52887-408E-48F0-8798-3C640D0295B3 --- src/xact.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/xact.cc') diff --git a/src/xact.cc b/src/xact.cc index 344f66ea..3c2505af 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -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. -- cgit v1.2.3