mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-27 03:10:32 -06:00
Large commit to get rid of a lot of static methods.
This commit is contained in:
parent
d9aa074330
commit
45f4395f26
@ -141,7 +141,7 @@ class StoredJournalEventHandler
|
||||
private function getExactAmount(TransactionJournal $journal, PiggyBank $piggyBank, PiggyBankRepetition $repetition): string
|
||||
{
|
||||
$amount = $journal->amountPositive();
|
||||
$sources = TransactionJournal::sourceAccountList($journal)->pluck('id')->toArray();
|
||||
$sources = $journal->sourceAccountList()->pluck('id')->toArray();
|
||||
$room = bcsub(strval($piggyBank->targetamount), strval($repetition->currentamount));
|
||||
$compare = bcmul($repetition->currentamount, '-1');
|
||||
|
||||
|
@ -100,7 +100,7 @@ class Controller extends BaseController
|
||||
*/
|
||||
protected function isOpeningBalance(TransactionJournal $journal): bool
|
||||
{
|
||||
return TransactionJournal::transactionTypeStr($journal) === TransactionType::OPENING_BALANCE;
|
||||
return $journal->transactionTypeStr() === TransactionType::OPENING_BALANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,7 +239,7 @@ class ReportController extends Controller
|
||||
$journals = $journals->filter(
|
||||
function (Transaction $transaction) use ($report) {
|
||||
// get the destinations:
|
||||
$sources = TransactionJournal::sourceAccountList($transaction->transactionJournal)->pluck('id')->toArray();
|
||||
$sources = $transaction->transactionJournal->sourceAccountList()->pluck('id')->toArray();
|
||||
|
||||
// do these intersect with the current list?
|
||||
return !empty(array_intersect($report, $sources));
|
||||
@ -275,7 +275,7 @@ class ReportController extends Controller
|
||||
$journals = $journals->filter(
|
||||
function (Transaction $transaction) use ($report) {
|
||||
// get the destinations:
|
||||
$destinations = $transaction->transactionJournal->destinationAccountList()->pluck('id')->toArray();
|
||||
$destinations = $transaction->destinationAccountList($transaction->transactionJournal)->pluck('id')->toArray();
|
||||
|
||||
// do these intersect with the current list?
|
||||
return !empty(array_intersect($report, $destinations));
|
||||
|
@ -195,7 +195,7 @@ class MassController extends Controller
|
||||
$journal = $repository->find(intval($journalId));
|
||||
if ($journal) {
|
||||
// get optional fields:
|
||||
$what = strtolower(TransactionJournal::transactionTypeStr($journal));
|
||||
$what = strtolower($journal->transactionTypeStr());
|
||||
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;
|
||||
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? '';
|
||||
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;
|
||||
|
@ -150,7 +150,7 @@ class SplitController extends Controller
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$type = strtolower(TransactionJournal::transactionTypeStr($journal));
|
||||
$type = strtolower($journal->transactionTypeStr());
|
||||
Session::flash('success', strval(trans('firefly.updated_' . $type, ['description' => e($data['journal_description'])])));
|
||||
Preferences::mark();
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf
|
||||
$fromAccountName = '';
|
||||
|
||||
/** @var Account $account */
|
||||
foreach (TransactionJournal::sourceAccountList($journal) as $account) {
|
||||
foreach ($journal->sourceAccountList() as $account) {
|
||||
$fromAccountName .= strtolower($account->name);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface
|
||||
$name = '';
|
||||
|
||||
/** @var Account $account */
|
||||
foreach (TransactionJournal::sourceAccountList($journal) as $account) {
|
||||
foreach ($journal->sourceAccountList() as $account) {
|
||||
$name .= strtolower($account->name);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface
|
||||
$name = '';
|
||||
|
||||
/** @var Account $account */
|
||||
foreach (TransactionJournal::sourceAccountList($journal) as $account) {
|
||||
foreach ($journal->sourceAccountList() as $account) {
|
||||
$name .= strtolower($account->name);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
|
||||
$name = '';
|
||||
|
||||
/** @var Account $account */
|
||||
foreach (TransactionJournal::sourceAccountList($journal) as $account) {
|
||||
foreach ($journal->sourceAccountList() as $account) {
|
||||
$name .= strtolower($account->name);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class Journal extends Twig_Extension
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$list = TransactionJournal::sourceAccountList($journal);
|
||||
$list = $journal->sourceAccountList();
|
||||
$array = [];
|
||||
/** @var Account $entry */
|
||||
foreach ($list as $entry) {
|
||||
|
Loading…
Reference in New Issue
Block a user