diff options
author | John Wiegley <johnw@newartisans.com> | 2012-02-27 11:52:23 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-02-27 11:52:23 -0600 |
commit | 5532a1a8b756f0f7499570afccb1d4fc3e9bc76d (patch) | |
tree | 0231741233df49ddfd221faa2c115f7c55829559 /src/journal.cc | |
parent | 2ec35ea6e98dcfb03fb8c2e90b85991aaa7be2fa (diff) | |
download | fork-ledger-5532a1a8b756f0f7499570afccb1d4fc3e9bc76d.tar.gz fork-ledger-5532a1a8b756f0f7499570afccb1d4fc3e9bc76d.tar.bz2 fork-ledger-5532a1a8b756f0f7499570afccb1d4fc3e9bc76d.zip |
Added --check-payees option
Diffstat (limited to 'src/journal.cc')
-rw-r--r-- | src/journal.cc | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/journal.cc b/src/journal.cc index 8f382125..355f3ee6 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -89,6 +89,7 @@ void journal_t::initialize() fixed_metadata = false; was_loaded = false; force_checking = false; + check_payees = false; checking_style = CHECK_PERMISSIVE; } @@ -160,26 +161,27 @@ string journal_t::register_payee(const string& name, xact_t *, const string&) { string payee; -#if 0 - std::set<string>::iterator i = known_payees.find(name); + if (check_payees && + (checking_style == CHECK_WARNING || checking_style == CHECK_ERROR)) { + std::set<string>::iterator i = known_payees.find(name); - if (i == known_payees.end()) { - if (! xact) { - if (force_checking) - fixed_payees = true; - known_payees.insert(name); - } - else if (! fixed_payees && xact->_state != item_t::UNCLEARED) { - known_payees.insert(name); - } - else if (checking_style == CHECK_WARNING) { - warning_(_("%1Unknown payee '%2'") << location << name); - } - else if (checking_style == CHECK_ERROR) { - throw_(parse_error, _("Unknown payee '%1'") << name); + if (i == known_payees.end()) { + if (! xact) { + if (force_checking) + fixed_payees = true; + known_payees.insert(name); + } + else if (! fixed_payees && xact->_state != item_t::UNCLEARED) { + known_payees.insert(name); + } + else if (checking_style == CHECK_WARNING) { + warning_(_("%1Unknown payee '%2'") << location << name); + } + else if (checking_style == CHECK_ERROR) { + throw_(parse_error, _("Unknown payee '%1'") << name); + } } } -#endif foreach (payee_mapping_t& value, payee_mappings) { if (value.first.match(name)) { |