mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
Code cleanup [skip-ci]
This commit is contained in:
@@ -156,8 +156,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface
|
||||
|
||||
public function getCashAccount()
|
||||
{
|
||||
$type = \AccountType::where('description','Cash account')->first();
|
||||
$cash = \Auth::user()->accounts()->where('account_type_id',$type->id)->first();
|
||||
$type = \AccountType::where('description', 'Cash account')->first();
|
||||
$cash = \Auth::user()->accounts()->where('account_type_id', $type->id)->first();
|
||||
return $cash;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Firefly\Storage\Budget;
|
||||
interface BudgetRepositoryInterface
|
||||
{
|
||||
public function getAsSelectList();
|
||||
|
||||
public function find($id);
|
||||
|
||||
}
|
||||
@@ -17,12 +17,12 @@ class EloquentComponentRepository implements ComponentRepositoryInterface
|
||||
|
||||
}
|
||||
|
||||
public function get() {
|
||||
public function get()
|
||||
{
|
||||
die('no impl');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function store($data)
|
||||
{
|
||||
if (!isset($data['class'])) {
|
||||
|
||||
@@ -20,7 +20,6 @@ class StorageServiceProvider extends ServiceProvider
|
||||
);
|
||||
|
||||
|
||||
|
||||
$this->app->bind(
|
||||
'Firefly\Storage\Account\AccountRepositoryInterface',
|
||||
'Firefly\Storage\Account\EloquentAccountRepository'
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Firefly\Storage\Transaction;
|
||||
|
||||
|
||||
class EloquentTransactionRepository implements TransactionRepositoryInterface {
|
||||
class EloquentTransactionRepository implements TransactionRepositoryInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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