mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Remove references to bill scanning.
This commit is contained in:
@@ -541,52 +541,6 @@ class BillRepository implements BillRepositoryInterface
|
||||
return $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Bill $bill
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function scan(Bill $bill, TransactionJournal $journal): bool
|
||||
{
|
||||
// Can only support withdrawals.
|
||||
if (false === $journal->isWithdrawal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var JournalRepositoryInterface $repos */
|
||||
$repos = app(JournalRepositoryInterface::class);
|
||||
$repos->setUser($this->user);
|
||||
|
||||
$destinationAccounts = $repos->getJournalDestinationAccounts($journal);
|
||||
$sourceAccounts = $repos->getJournalDestinationAccounts($journal);
|
||||
$matches = explode(',', $bill->match);
|
||||
$description = strtolower($journal->description) . ' ';
|
||||
$description .= strtolower(implode(' ', $destinationAccounts->pluck('name')->toArray()));
|
||||
$description .= strtolower(implode(' ', $sourceAccounts->pluck('name')->toArray()));
|
||||
|
||||
$wordMatch = $this->doWordMatch($matches, $description);
|
||||
$amountMatch = $this->doAmountMatch($repos->getJournalTotal($journal), $bill->amount_min, $bill->amount_max);
|
||||
|
||||
// when both, update!
|
||||
if ($wordMatch && $amountMatch) {
|
||||
$journal->bill()->associate($bill);
|
||||
$journal->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($bill->id === $journal->bill_id) {
|
||||
// if no match, but bill used to match, remove it:
|
||||
$journal->bill_id = null;
|
||||
$journal->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
@@ -196,14 +196,6 @@ interface BillRepositoryInterface
|
||||
*/
|
||||
public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon;
|
||||
|
||||
/**
|
||||
* @param Bill $bill
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function scan(Bill $bill, TransactionJournal $journal): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
Reference in New Issue
Block a user