Added a lot of todo things.

This commit is contained in:
James Cole
2016-05-15 15:24:23 +02:00
parent 60d732067b
commit 4164ebcc69
20 changed files with 70 additions and 319 deletions

View File

@@ -5,13 +5,10 @@ namespace FireflyIII\Repositories\Bill;
use Carbon\Carbon;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
@@ -431,12 +428,12 @@ class BillRepository implements BillRepositoryInterface
if (false === $journal->isWithdrawal()) {
return false;
}
$matches = explode(',', $bill->match);
$description = strtolower($journal->description) . ' ' . strtolower(TransactionJournal::destinationAccount($journal)->name);
// new: add source to word match:
$description .= ' ' . strtolower(TransactionJournal::sourceAccount($journal)->name);
$destinationAccounts = TransactionJournal::destinationAccountList($journal);
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$matches = explode(',', $bill->match);
$description = strtolower($journal->description) . ' ';
$description .= strtolower(join(' ', $destinationAccounts->pluck('name')->toArray()));
$description .= strtolower(join(' ', $sourceAccounts->pluck('name')->toArray()));
$wordMatch = $this->doWordMatch($matches, $description);
$amountMatch = $this->doAmountMatch(TransactionJournal::amountPositive($journal), $bill->amount_min, $bill->amount_max);