Large commit to get rid of a lot of static methods.

This commit is contained in:
James Cole 2017-03-04 07:26:03 +01:00
parent d9aa074330
commit 45f4395f26
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
10 changed files with 11 additions and 11 deletions

View File

@ -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');

View File

@ -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;
}
/**

View File

@ -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));

View File

@ -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;

View File

@ -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();

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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) {