mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup [skip-ci]
This commit is contained in:
@@ -38,15 +38,15 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
$amountFrom = $amount * -1;
|
||||
$amountTo = $amount;
|
||||
|
||||
if(round(floatval($amount),2) == 0.00) {
|
||||
if (round(floatval($amount), 2) == 0.00) {
|
||||
\Log::error('Transaction will never save: amount = 0');
|
||||
\Session::flash('error','The amount should not be empty or zero.');
|
||||
\Session::flash('error', 'The amount should not be empty or zero.');
|
||||
throw new \Firefly\Exception\FireflyException('Could not figure out transaction type.');
|
||||
}
|
||||
// same account:
|
||||
if($from->id == $to->id) {
|
||||
if ($from->id == $to->id) {
|
||||
\Log::error('Accounts cannot be equal');
|
||||
\Session::flash('error','Select two different accounts.');
|
||||
\Session::flash('error', 'Select two different accounts.');
|
||||
throw new \Firefly\Exception\FireflyException('Select two different accounts.');
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
if (!$journal->save()) {
|
||||
\Log::error('Cannot create valid journal.');
|
||||
\Log::error('Errors: ' . print_r($journal->errors()->all(), true));
|
||||
\Session::flash('error','Could not create journal: ' . $journal->errors()->first());
|
||||
\Session::flash('error', 'Could not create journal: ' . $journal->errors()->first());
|
||||
throw new \Firefly\Exception\FireflyException('Cannot create valid journal.');
|
||||
}
|
||||
$journal->save();
|
||||
@@ -173,7 +173,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
}]
|
||||
)
|
||||
->after($start)->before($end)
|
||||
->where('completed',1)
|
||||
->where('completed', 1)
|
||||
->whereIn('transaction_type_id', $types)
|
||||
->get(['transaction_journals.*']);
|
||||
unset($types);
|
||||
@@ -182,8 +182,9 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
// has to be one:
|
||||
if(!isset($journal->transactions[0])) {
|
||||
throw new FireflyException('Journal #'.$journal->id.' has ' . count($journal->transactions).' transactions!');
|
||||
if (!isset($journal->transactions[0])) {
|
||||
throw new FireflyException('Journal #' . $journal->id . ' has ' . count($journal->transactions)
|
||||
. ' transactions!');
|
||||
}
|
||||
$transaction = $journal->transactions[0];
|
||||
$amount = floatval($transaction->amount);
|
||||
|
@@ -12,7 +12,9 @@ interface TransactionJournalRepositoryInterface
|
||||
public function getByAccount(\Account $account, $count = 25);
|
||||
|
||||
public function homeBudgetChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
|
||||
public function homeCategoryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
|
||||
public function homeBeneficiaryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
|
||||
public function homeComponentChart(\Carbon\Carbon $start, \Carbon\Carbon $end, $chartType);
|
||||
|
Reference in New Issue
Block a user