diff options
author | John Wiegley <johnw@newartisans.com> | 2012-11-12 01:37:14 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-11-12 02:30:04 -0600 |
commit | 29359f3a878c6017bb00f2aa8fcac91a2af5ddc5 (patch) | |
tree | 455915a13b6194b39e61668772a0c34da00a1b83 /src/xact.cc | |
parent | e77e9d692aea5a061f6fde144a56de085b1a74c4 (diff) | |
download | fork-ledger-29359f3a878c6017bb00f2aa8fcac91a2af5ddc5.tar.gz fork-ledger-29359f3a878c6017bb00f2aa8fcac91a2af5ddc5.tar.bz2 fork-ledger-29359f3a878c6017bb00f2aa8fcac91a2af5ddc5.zip |
Account names in auto-xacts can be format strings
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xact.cc b/src/xact.cc index ec1d372c..cac19a02 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -36,6 +36,7 @@ #include "account.h" #include "journal.h" #include "context.h" +#include "format.h" #include "pool.h" namespace ledger { @@ -775,6 +776,14 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context) account = account->parent; account = account->find_account(fullname); } + else if (contains(fullname, "%")) { + format_t account_name(fullname); + std::ostringstream buf; + buf << account_name(bound_scope); + while (account->parent) + account = account->parent; + account = account->find_account(buf.str()); + } // Copy over details so that the resulting post is a mirror of // the automated xact's one. |