From d1329be2fa7be6b01d74ad7c49c1fa5109d2a65e Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 20 Nov 2015 20:13:10 +0100 Subject: [PATCH] Bill scan routine should not grab transfers and income. --- app/Repositories/Bill/BillRepository.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index f852266d03..3b8215729e 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -276,12 +276,21 @@ class BillRepository implements BillRepositoryInterface */ public function scan(Bill $bill, TransactionJournal $journal) { + + /* + * Can only support withdrawals. + */ + if ($journal->transactionType->type !== 'Withdrawal') { + return false; + } + $matches = explode(',', $bill->match); $description = strtolower($journal->description) . ' ' . strtolower($journal->destination_account->name); $wordMatch = $this->doWordMatch($matches, $description); $amountMatch = $this->doAmountMatch($journal->amount_positive, $bill->amount_min, $bill->amount_max); Log::debug('Journal #' . $journal->id . ' has description "' . $description . '"'); + /* * If both, update! */