Account names in auto-xacts can be format strings

This commit is contained in:
John Wiegley 2012-11-12 01:37:14 -06:00
parent e77e9d692a
commit 29359f3a87

View file

@ -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.