Clean up method relying on old transaction journal code.

This commit is contained in:
James Cole
2016-03-02 20:11:28 +01:00
parent 5b949d6e00
commit 7234f011ec
19 changed files with 156 additions and 48 deletions

View File

@@ -443,13 +443,6 @@ class BillRepository implements BillRepositoryInterface
*/
public function scan(Bill $bill, TransactionJournal $journal): bool
{
// grab the expanded info for this journal.
// looks weird, but is useful:
/** @var TransactionJournal $journal */
$journal = TransactionJournal::expanded()->where('transaction_journals.id', $journal->id)->get(TransactionJournal::QUERYFIELDS)->first();
// TODO REMOVE this in favour of something static in TransactionJournal.
/*
* Can only support withdrawals.
*/
@@ -458,9 +451,9 @@ class BillRepository implements BillRepositoryInterface
}
$matches = explode(',', $bill->match);
$description = strtolower($journal->description) . ' ' . strtolower($journal->destination_account_name);
$description = strtolower($journal->description) . ' ' . strtolower(TransactionJournal::destinationAccount($journal)->name);
$wordMatch = $this->doWordMatch($matches, $description);
$amountMatch = $this->doAmountMatch($journal->destination_amount, $bill->amount_min, $bill->amount_max);
$amountMatch = $this->doAmountMatch(TransactionJournal::amountPositive($journal), $bill->amount_min, $bill->amount_max);
Log::debug('Journal #' . $journal->id . ' has description "' . $description . '"');