mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 14:12:15 +00:00
Clean up method relying on old transaction journal code.
This commit is contained in:
@@ -212,7 +212,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$offset = ($page - 1) * 50;
|
||||
$query = Auth::user()
|
||||
->transactionJournals()
|
||||
->expanded()// TODO firefly will crash here.
|
||||
->expanded()
|
||||
->where(
|
||||
function (Builder $q) use ($account) {
|
||||
$q->where('destination.account_id', $account->id);
|
||||
|
||||
@@ -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 . '"');
|
||||
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
{
|
||||
$offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
|
||||
$setQuery = $budget->transactionjournals()->expanded()
|
||||
->take($take)->offset($offset)// TODO firefly will crash here.
|
||||
->take($take)->offset($offset)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC');
|
||||
|
||||
@@ -129,8 +129,8 @@ class TagRepository implements TagRepositoryInterface
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
if ($journal->destination_account->id == $account->id) { // TODO TransactionJournal cannot deliver "destination_account"
|
||||
$amount = bcadd($amount, $journal->amount); // TODO TransactionJournal cannot deliver "amount".
|
||||
if (TransactionJournal::destinationAccount($journal)->id == $account->id) {
|
||||
$amount = bcadd($amount, TransactionJournal::amount($journal));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,10 +376,11 @@ class TagRepository implements TagRepositoryInterface
|
||||
foreach ($tag->transactionjournals as $check) {
|
||||
// $checkAccount is the source_account for a withdrawal
|
||||
// $checkAccount is the destination_account for a deposit
|
||||
if ($check->isWithdrawal() && $check->source_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "source_account"
|
||||
|
||||
if ($check->isWithdrawal() && TransactionJournal::sourceAccount($check)->id != TransactionJournal::destinationAccount($journal)->id) {
|
||||
$match = false;
|
||||
}
|
||||
if ($check->isDeposit() && $check->destination_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "destination_account"
|
||||
if ($check->isDeposit() && TransactionJournal::destinationAccount($check)->id != TransactionJournal::destinationAccount($journal)->id) {
|
||||
$match = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user