summaryrefslogtreecommitdiff
path: root/src/journal.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-07 00:33:24 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-07 00:33:24 -0600
commit023033f182d1cc0418d1856f544669a79f7bac6b (patch)
tree4cc93a9d6f707e76b78ec2f4351fba63672a1743 /src/journal.cc
parent9ea5b608991ee1769e18d95c2b2dce5a6f4202d5 (diff)
downloadfork-ledger-023033f182d1cc0418d1856f544669a79f7bac6b.tar.gz
fork-ledger-023033f182d1cc0418d1856f544669a79f7bac6b.tar.bz2
fork-ledger-023033f182d1cc0418d1856f544669a79f7bac6b.zip
Added a few comments
Diffstat (limited to 'src/journal.cc')
-rw-r--r--src/journal.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/journal.cc b/src/journal.cc
index 55c89dd9..71492ed2 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -122,14 +122,21 @@ account_t * journal_t::register_account(const string& name, post_t * post,
{
account_t * result = NULL;
+ // If there any account aliases, substitute before creating an account
+ // object.
if (account_aliases.size() > 0) {
accounts_map::const_iterator i = account_aliases.find(name);
if (i != account_aliases.end())
result = (*i).second;
}
+
+ // Create the account object and associate it with the journal; this
+ // is registering the account.
if (! result)
result = master_account->find_account(name);
+ // If the account name being registered is "Unknown", check whether
+ // the payee indicates an account that should be used.
if (result->name == _("Unknown")) {
foreach (account_mapping_t& value, payees_for_unknown_accounts) {
if (value.first.match(post->xact->payee)) {
@@ -139,6 +146,8 @@ account_t * journal_t::register_account(const string& name, post_t * post,
}
}
+ // Now that we have an account, make certain that the account is
+ // "known", if the user has requested validation of that fact.
if (checking_style == CHECK_WARNING || checking_style == CHECK_ERROR) {
if (! result->has_flags(ACCOUNT_KNOWN)) {
if (! post) {