summaryrefslogtreecommitdiff
path: root/src/draft.cc
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2011-10-06 22:07:01 -0700
committerCraig Earls <enderw88@gmail.com>2011-10-06 22:07:01 -0700
commitb400d65be082165f44e769605aa6a78133cf6d9a (patch)
tree27b18ee35a5c4f60a10cf4f626e15ac30276040b /src/draft.cc
parente9ccb012c2c5ffe0e9f4916ee859bda95d9d4248 (diff)
parentf0791bbd7297e737d9e13d0b0bb21473b173b2a7 (diff)
downloadfork-ledger-b400d65be082165f44e769605aa6a78133cf6d9a.tar.gz
fork-ledger-b400d65be082165f44e769605aa6a78133cf6d9a.tar.bz2
fork-ledger-b400d65be082165f44e769605aa6a78133cf6d9a.zip
Merge remote branch 'upstream/next' into next
Diffstat (limited to 'src/draft.cc')
-rw-r--r--src/draft.cc18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/draft.cc b/src/draft.cc
index ba78fc42..0cce1d5d 100644
--- a/src/draft.cc
+++ b/src/draft.cc
@@ -66,16 +66,6 @@ void draft_t::xact_template_t::dump(std::ostream& out) const
<< _("<Posting copied from last related transaction>")
<< std::endl;
} else {
- bool has_only_from = true;
- bool has_only_to = true;
-
- foreach (const post_template_t& post, posts) {
- if (post.from)
- has_only_to = false;
- else
- has_only_from = false;
- }
-
foreach (const post_template_t& post, posts) {
straccstream accum;
out << std::endl
@@ -245,12 +235,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;