summaryrefslogtreecommitdiff
path: root/src/draft.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-07-19 23:29:31 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-07-19 23:29:31 -0500
commit966b6fc359bacad6b22e79fd5afbec0ea80e8d6a (patch)
tree324ed3f2e18bed15952cc60dc92e31fc6f8ec43c /src/draft.cc
parentd0dfff62a6a3a685f19a5bed8716f7b661dc8c60 (diff)
downloadfork-ledger-966b6fc359bacad6b22e79fd5afbec0ea80e8d6a.tar.gz
fork-ledger-966b6fc359bacad6b22e79fd5afbec0ea80e8d6a.tar.bz2
fork-ledger-966b6fc359bacad6b22e79fd5afbec0ea80e8d6a.zip
Lookup probable accounts in reverse historical order
Fixes #510
Diffstat (limited to 'src/draft.cc')
-rw-r--r--src/draft.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/draft.cc b/src/draft.cc
index ba78fc42..ca2d35df 100644
--- a/src/draft.cc
+++ b/src/draft.cc
@@ -245,12 +245,12 @@ xact_t * draft_t::insert(journal_t& journal)
if (tmpl->payee_mask.empty())
throw std::runtime_error(_("'xact' command requires at least a payee"));
- xact_t * matching = NULL;
-
+ xact_t * matching = NULL;
std::auto_ptr<xact_t> added(new xact_t);
- xacts_iterator xi(journal);
- if (xact_t * xact = lookup_probable_account(tmpl->payee_mask.str(), xi).first) {
+ if (xact_t * xact =
+ lookup_probable_account(tmpl->payee_mask.str(), journal.xacts.rbegin(),
+ journal.xacts.rend()).first) {
DEBUG("draft.xact", "Found payee by lookup: transaction on line "
<< xact->pos->beg_line);
matching = xact;