Fix some minor scrutinizer issues.

This commit is contained in:
James Cole
2016-11-28 20:38:03 +01:00
parent a6a2c0c182
commit b33aa733c7
12 changed files with 23 additions and 47 deletions

View File

@@ -109,8 +109,7 @@ class Transaction extends Twig_Extension
'optionalJournalAmount', function (int $journalId, string $transactionAmount, string $code, string $type): string {
$amount = strval(
TransactionModel
::where('transaction_journal_id', $journalId)
TransactionModel::where('transaction_journal_id', $journalId)
->whereNull('deleted_at')
->where('amount', '<', 0)
->sum('amount')
@@ -204,8 +203,7 @@ class Transaction extends Twig_Extension
// if the amount is negative, find the opposing account and use that one:
$journalId = $transaction->journal_id;
/** @var TransactionModel $other */
$other = TransactionModel
::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
@@ -278,8 +276,7 @@ class Transaction extends Twig_Extension
if (bccomp($transaction->transaction_amount, '0') === 1 && is_null($transaction->opposing_account_id)) {
$journalId = $transaction->journal_id;
/** @var TransactionModel $other */
$other = TransactionModel
::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')