diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-22 14:49:46 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-22 21:35:02 -0400 |
commit | a596727d3d2cef76e7347f3695d5d04067b24d19 (patch) | |
tree | 7c8fdd84d3b5a43969d603fd6c8d663de48b14ee /src | |
parent | 68056c194895f9943a8b8cbdccf52fa369322612 (diff) | |
download | fork-ledger-a596727d3d2cef76e7347f3695d5d04067b24d19.tar.gz fork-ledger-a596727d3d2cef76e7347f3695d5d04067b24d19.tar.bz2 fork-ledger-a596727d3d2cef76e7347f3695d5d04067b24d19.zip |
Interpolate uses of $account in automated postings
Fixes 5CB52887-408E-48F0-8798-3C640D0295B3
Diffstat (limited to 'src')
-rw-r--r-- | src/xact.cc | 10 |
1 files changed, 8 insertions, 2 deletions
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. |