Bill scan routine should not grab transfers and income.

This commit is contained in:
James Cole
2015-11-20 20:13:10 +01:00
parent 3ed6561702
commit d1329be2fa

View File

@@ -276,12 +276,21 @@ class BillRepository implements BillRepositoryInterface
*/ */
public function scan(Bill $bill, TransactionJournal $journal) public function scan(Bill $bill, TransactionJournal $journal)
{ {
/*
* Can only support withdrawals.
*/
if ($journal->transactionType->type !== 'Withdrawal') {
return false;
}
$matches = explode(',', $bill->match); $matches = explode(',', $bill->match);
$description = strtolower($journal->description) . ' ' . strtolower($journal->destination_account->name); $description = strtolower($journal->description) . ' ' . strtolower($journal->destination_account->name);
$wordMatch = $this->doWordMatch($matches, $description); $wordMatch = $this->doWordMatch($matches, $description);
$amountMatch = $this->doAmountMatch($journal->amount_positive, $bill->amount_min, $bill->amount_max); $amountMatch = $this->doAmountMatch($journal->amount_positive, $bill->amount_min, $bill->amount_max);
Log::debug('Journal #' . $journal->id . ' has description "' . $description . '"'); Log::debug('Journal #' . $journal->id . ' has description "' . $description . '"');
/* /*
* If both, update! * If both, update!
*/ */