parent
d0dfff62a6
commit
966b6fc359
4 changed files with 16 additions and 17 deletions
|
|
@ -121,14 +121,10 @@ value_t convert_command(call_scope_t& args)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (xact->posts.front()->account == NULL) {
|
if (xact->posts.front()->account == NULL) {
|
||||||
xacts_iterator xi;
|
|
||||||
xi.xacts_i = current_xacts.begin();
|
|
||||||
xi.xacts_end = current_xacts.end();
|
|
||||||
xi.xacts_uninitialized = false;
|
|
||||||
|
|
||||||
// jww (2010-03-07): Bind this logic to an option: --auto-match
|
// jww (2010-03-07): Bind this logic to an option: --auto-match
|
||||||
if (account_t * acct =
|
if (account_t * acct =
|
||||||
lookup_probable_account(xact->payee, xi, bucket).second)
|
lookup_probable_account(xact->payee, current_xacts.rbegin(),
|
||||||
|
current_xacts.rend(), bucket).second)
|
||||||
xact->posts.front()->account = acct;
|
xact->posts.front()->account = acct;
|
||||||
else
|
else
|
||||||
xact->posts.front()->account = unknown;
|
xact->posts.front()->account = unknown;
|
||||||
|
|
|
||||||
|
|
@ -245,12 +245,12 @@ xact_t * draft_t::insert(journal_t& journal)
|
||||||
if (tmpl->payee_mask.empty())
|
if (tmpl->payee_mask.empty())
|
||||||
throw std::runtime_error(_("'xact' command requires at least a payee"));
|
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);
|
std::auto_ptr<xact_t> added(new xact_t);
|
||||||
|
|
||||||
xacts_iterator xi(journal);
|
if (xact_t * xact =
|
||||||
if (xact_t * xact = lookup_probable_account(tmpl->payee_mask.str(), xi).first) {
|
lookup_probable_account(tmpl->payee_mask.str(), journal.xacts.rbegin(),
|
||||||
|
journal.xacts.rend()).first) {
|
||||||
DEBUG("draft.xact", "Found payee by lookup: transaction on line "
|
DEBUG("draft.xact", "Found payee by lookup: transaction on line "
|
||||||
<< xact->pos->beg_line);
|
<< xact->pos->beg_line);
|
||||||
matching = xact;
|
matching = xact;
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,10 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<xact_t *, account_t *>
|
std::pair<xact_t *, account_t *>
|
||||||
lookup_probable_account(const string& ident,
|
lookup_probable_account(const string& ident,
|
||||||
xacts_iterator& iter_func,
|
xacts_list::reverse_iterator iter,
|
||||||
account_t * ref_account)
|
xacts_list::reverse_iterator end,
|
||||||
|
account_t * ref_account)
|
||||||
{
|
{
|
||||||
scorecard_t scores;
|
scorecard_t scores;
|
||||||
|
|
||||||
|
|
@ -83,7 +84,8 @@ lookup_probable_account(const string& ident,
|
||||||
" with reference account: " << ref_account->fullname());
|
" with reference account: " << ref_account->fullname());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (xact_t * xact = iter_func()) {
|
xact_t * xact;
|
||||||
|
while (iter != end && (xact = *iter++) != NULL) {
|
||||||
#if 0
|
#if 0
|
||||||
// Only consider transactions from the last two years (jww (2010-03-07):
|
// Only consider transactions from the last two years (jww (2010-03-07):
|
||||||
// make this an option)
|
// make this an option)
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,10 @@
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
std::pair<xact_t *, account_t *>
|
std::pair<xact_t *, account_t *>
|
||||||
lookup_probable_account(const string& ident,
|
lookup_probable_account(const string& ident,
|
||||||
xacts_iterator& iter_func,
|
xacts_list::reverse_iterator iter,
|
||||||
account_t * ref_account = NULL);
|
xacts_list::reverse_iterator end,
|
||||||
|
account_t * ref_account = NULL);
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue