@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function act(TransactionJournal $journal): bool |
55 | 55 | { |
56 | - $search = $this->action->action_value; |
|
56 | + $search = $this->action->action_value; |
|
57 | 57 | |
58 | 58 | $budget = $journal->user->budgets()->where('name', $search)->first(); |
59 | 59 | if (null === $budget) { |
@@ -76,7 +76,7 @@ |
||
76 | 76 | str_replace('FireflyIII\\Models\\', '', TransactionJournal::class), |
77 | 77 | ] |
78 | 78 | ); |
79 | - $model = $this->string('model'); |
|
79 | + $model = $this->string('model'); |
|
80 | 80 | return [ |
81 | 81 | 'filename' => 'required|between:1,255', |
82 | 82 | 'title' => 'between:1,255', |
@@ -56,9 +56,9 @@ |
||
56 | 56 | public function findTransaction(int $transactionId): ?Transaction |
57 | 57 | { |
58 | 58 | $transaction = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
59 | - ->where('transaction_journals.user_id', $this->user->id) |
|
60 | - ->where('transactions.id', $transactionId) |
|
61 | - ->first(['transactions.*']); |
|
59 | + ->where('transaction_journals.user_id', $this->user->id) |
|
60 | + ->where('transactions.id', $transactionId) |
|
61 | + ->first(['transactions.*']); |
|
62 | 62 | |
63 | 63 | return $transaction; |
64 | 64 | } |
@@ -570,7 +570,7 @@ |
||
570 | 570 | return new Carbon($cache->get()); // @codeCoverageIgnore |
571 | 571 | } |
572 | 572 | $entry = TransactionJournalMeta::where('transaction_journal_id', $journalId) |
573 | - ->where('name', $field)->first(); |
|
573 | + ->where('name', $field)->first(); |
|
574 | 574 | if (null === $entry) { |
575 | 575 | return null; |
576 | 576 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction |
138 | 138 | { |
139 | 139 | $set = $journal->transactions->filter( |
140 | - static function (Transaction $subject) use ($transaction) { |
|
140 | + static function(Transaction $subject) use ($transaction) { |
|
141 | 141 | $amount = (float)$transaction->amount * -1 === (float)$subject->amount; |
142 | 142 | $identifier = $transaction->identifier === $subject->identifier; |
143 | 143 | Log::debug(sprintf('Amount the same? %s', var_export($amount, true))); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | private function getDestinationTransactions(TransactionJournal $journal): Collection |
159 | 159 | { |
160 | 160 | return $journal->transactions->filter( |
161 | - static function (Transaction $transaction) { |
|
161 | + static function(Transaction $transaction) { |
|
162 | 162 | return $transaction->amount > 0; |
163 | 163 | } |
164 | 164 | ); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $this->groupFactory->setUser($journal->user); |
255 | 255 | $this->cliRepository->setUser($journal->user); |
256 | 256 | |
257 | - $data = [ |
|
257 | + $data = [ |
|
258 | 258 | // mandatory fields. |
259 | 259 | 'group_title' => $journal->description, |
260 | 260 | 'transactions' => [], |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | $this->app->bind( |
67 | 67 | GroupCollectorInterface::class, |
68 | - static function (Application $app) { |
|
68 | + static function(Application $app) { |
|
69 | 69 | /** @var GroupCollectorInterface $collector */ |
70 | 70 | $collector = app(GroupCollector::class); |
71 | 71 | if ($app->auth->check()) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $this->app->bind( |
86 | 86 | TransactionGroupRepositoryInterface::class, |
87 | - static function (Application $app) { |
|
87 | + static function(Application $app) { |
|
88 | 88 | /** @var TransactionGroupRepositoryInterface $repository */ |
89 | 89 | $repository = app(TransactionGroupRepository::class); |
90 | 90 | if ($app->auth->check()) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $this->app->bind( |
105 | 105 | JournalRepositoryInterface::class, |
106 | - static function (Application $app) { |
|
106 | + static function(Application $app) { |
|
107 | 107 | /** @var JournalRepositoryInterface $repository */ |
108 | 108 | $repository = app(JournalRepository::class); |
109 | 109 | if ($app->auth->check()) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // also bind new API repository |
118 | 118 | $this->app->bind( |
119 | 119 | JournalAPIRepositoryInterface::class, |
120 | - static function (Application $app) { |
|
120 | + static function(Application $app) { |
|
121 | 121 | /** @var JournalAPIRepositoryInterface $repository */ |
122 | 122 | $repository = app(JournalAPIRepository::class); |
123 | 123 | if ($app->auth->check()) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // also bind new CLI repository |
132 | 132 | $this->app->bind( |
133 | 133 | JournalCLIRepositoryInterface::class, |
134 | - static function (Application $app) { |
|
134 | + static function(Application $app) { |
|
135 | 135 | /** @var JournalCLIRepositoryInterface $repository */ |
136 | 136 | $repository = app(JournalCLIRepository::class); |
137 | 137 | if ($app->auth->check()) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function activeLongAccountList(string $name, $value = null, array $options = null): string |
85 | 85 | { |
86 | - $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN,]; |
|
86 | + $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, ]; |
|
87 | 87 | $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; |
88 | 88 | $repository = $this->getAccountRepository(); |
89 | 89 | $accountList = $repository->getActiveAccountsByType($types); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function activeWithdrawalDestinations(string $name, $value = null, array $options = null): string |
128 | 128 | { |
129 | - $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::EXPENSE,]; |
|
129 | + $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::EXPENSE, ]; |
|
130 | 130 | $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; |
131 | 131 | $repository = $this->getAccountRepository(); |
132 | 132 | $accountList = $repository->getActiveAccountsByType($types); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function activeDepositDestinations(string $name, $value = null, array $options = null): string |
177 | 177 | { |
178 | - $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::REVENUE,]; |
|
178 | + $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::REVENUE, ]; |
|
179 | 179 | $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; |
180 | 180 | $repository = $this->getAccountRepository(); |
181 | 181 | $accountList = $repository->getActiveAccountsByType($types); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function longAccountList(string $name, $value = null, array $options = null): string |
304 | 304 | { |
305 | - $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN,]; |
|
305 | + $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, ]; |
|
306 | 306 | $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; |
307 | 307 | $repository = $this->getAccountRepository(); |
308 | 308 | $accountList = $repository->getAccountsByType($types); |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | |
64 | 64 | // first part: get all balances in own currency: |
65 | 65 | $nativeBalance = (string)$account->transactions() |
66 | - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
67 | - ->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59')) |
|
68 | - ->where('transactions.transaction_currency_id', $currency->id) |
|
69 | - ->sum('transactions.amount'); |
|
66 | + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
67 | + ->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59')) |
|
68 | + ->where('transactions.transaction_currency_id', $currency->id) |
|
69 | + ->sum('transactions.amount'); |
|
70 | 70 | |
71 | 71 | // get all balances in foreign currency: |
72 | 72 | $foreignBalance = (string)$account->transactions() |
73 | - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
74 | - ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
75 | - ->where('transactions.foreign_currency_id', $currency->id) |
|
76 | - ->where('transactions.transaction_currency_id', '!=', $currency->id) |
|
77 | - ->sum('transactions.foreign_amount'); |
|
73 | + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
74 | + ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
75 | + ->where('transactions.foreign_currency_id', $currency->id) |
|
76 | + ->where('transactions.transaction_currency_id', '!=', $currency->id) |
|
77 | + ->sum('transactions.foreign_amount'); |
|
78 | 78 | |
79 | 79 | $balance = bcadd($nativeBalance, $foreignBalance); |
80 | 80 | $virtual = null === $account->virtual_balance ? '0' : (string)$account->virtual_balance; |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | |
110 | 110 | $currencyId = (int)$repository->getMetaValue($account, 'currency_id'); |
111 | 111 | $nativeBalance = (string)$account->transactions() |
112 | - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
113 | - ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
114 | - ->where('transactions.transaction_currency_id', $currencyId) |
|
115 | - ->sum('transactions.amount'); |
|
112 | + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
113 | + ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
114 | + ->where('transactions.transaction_currency_id', $currencyId) |
|
115 | + ->sum('transactions.amount'); |
|
116 | 116 | |
117 | 117 | // get all balances in foreign currency: |
118 | 118 | $foreignBalance = (string)$account->transactions() |
119 | - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
120 | - ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
121 | - ->where('transactions.foreign_currency_id', $currencyId) |
|
122 | - ->where('transactions.transaction_currency_id', '!=', $currencyId) |
|
123 | - ->sum('transactions.foreign_amount'); |
|
119 | + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
120 | + ->where('transaction_journals.date', '<=', $date->format('Y-m-d')) |
|
121 | + ->where('transactions.foreign_currency_id', $currencyId) |
|
122 | + ->where('transactions.transaction_currency_id', '!=', $currencyId) |
|
123 | + ->sum('transactions.foreign_amount'); |
|
124 | 124 | $balance = bcadd($nativeBalance, $foreignBalance); |
125 | 125 | |
126 | 126 | $cache->store($balance); |
@@ -177,23 +177,23 @@ discard block |
||
177 | 177 | |
178 | 178 | // query! |
179 | 179 | $set = $account->transactions() |
180 | - ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') |
|
181 | - ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')) |
|
182 | - ->where('transaction_journals.date', '<=', $end->format('Y-m-d 23:59:59')) |
|
183 | - ->groupBy('transaction_journals.date') |
|
184 | - ->groupBy('transactions.transaction_currency_id') |
|
185 | - ->groupBy('transactions.foreign_currency_id') |
|
186 | - ->orderBy('transaction_journals.date', 'ASC') |
|
187 | - ->whereNull('transaction_journals.deleted_at') |
|
188 | - ->get( |
|
189 | - [ |
|
190 | - 'transaction_journals.date', |
|
191 | - 'transactions.transaction_currency_id', |
|
192 | - DB::raw('SUM(transactions.amount) AS modified'), |
|
193 | - 'transactions.foreign_currency_id', |
|
194 | - DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'), |
|
195 | - ] |
|
196 | - ); |
|
180 | + ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') |
|
181 | + ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')) |
|
182 | + ->where('transaction_journals.date', '<=', $end->format('Y-m-d 23:59:59')) |
|
183 | + ->groupBy('transaction_journals.date') |
|
184 | + ->groupBy('transactions.transaction_currency_id') |
|
185 | + ->groupBy('transactions.foreign_currency_id') |
|
186 | + ->orderBy('transaction_journals.date', 'ASC') |
|
187 | + ->whereNull('transaction_journals.deleted_at') |
|
188 | + ->get( |
|
189 | + [ |
|
190 | + 'transaction_journals.date', |
|
191 | + 'transactions.transaction_currency_id', |
|
192 | + DB::raw('SUM(transactions.amount) AS modified'), |
|
193 | + 'transactions.foreign_currency_id', |
|
194 | + DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'), |
|
195 | + ] |
|
196 | + ); |
|
197 | 197 | |
198 | 198 | $currentBalance = $startBalance; |
199 | 199 | /** @var Transaction $entry */ |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | $list = []; |
403 | 403 | |
404 | 404 | $set = auth()->user()->transactions() |
405 | - ->whereIn('transactions.account_id', $accounts) |
|
406 | - ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) |
|
407 | - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]); |
|
405 | + ->whereIn('transactions.account_id', $accounts) |
|
406 | + ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) |
|
407 | + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]); |
|
408 | 408 | |
409 | 409 | foreach ($set as $entry) { |
410 | 410 | $list[(int)$entry->account_id] = new Carbon($entry->max_date); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | Validator::resolver( |
93 | 93 | /** @noinspection MoreThanThreeArgumentsInspection */ |
94 | - function ($translator, $data, $rules, $messages) { |
|
94 | + function($translator, $data, $rules, $messages) { |
|
95 | 95 | return new FireflyValidator($translator, $data, $rules, $messages); |
96 | 96 | } |
97 | 97 | ); |
@@ -114,66 +114,66 @@ discard block |
||
114 | 114 | { |
115 | 115 | $this->app->bind( |
116 | 116 | 'preferences', |
117 | - function () { |
|
117 | + function() { |
|
118 | 118 | return new Preferences; |
119 | 119 | } |
120 | 120 | ); |
121 | 121 | |
122 | 122 | $this->app->bind( |
123 | 123 | 'fireflyconfig', |
124 | - function () { |
|
124 | + function() { |
|
125 | 125 | return new FireflyConfig; |
126 | 126 | } |
127 | 127 | ); |
128 | 128 | $this->app->bind( |
129 | 129 | 'navigation', |
130 | - function () { |
|
130 | + function() { |
|
131 | 131 | return new Navigation; |
132 | 132 | } |
133 | 133 | ); |
134 | 134 | $this->app->bind( |
135 | 135 | 'amount', |
136 | - function () { |
|
136 | + function() { |
|
137 | 137 | return new Amount; |
138 | 138 | } |
139 | 139 | ); |
140 | 140 | |
141 | 141 | $this->app->bind( |
142 | 142 | 'steam', |
143 | - function () { |
|
143 | + function() { |
|
144 | 144 | return new Steam; |
145 | 145 | } |
146 | 146 | ); |
147 | 147 | $this->app->bind( |
148 | 148 | 'expandedform', |
149 | - static function () { |
|
149 | + static function() { |
|
150 | 150 | return new ExpandedForm; |
151 | 151 | } |
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->app->bind( |
155 | 155 | 'accountform', |
156 | - static function () { |
|
156 | + static function() { |
|
157 | 157 | return new AccountForm; |
158 | 158 | } |
159 | 159 | ); |
160 | 160 | $this->app->bind( |
161 | 161 | 'currencyform', |
162 | - static function () { |
|
162 | + static function() { |
|
163 | 163 | return new CurrencyForm; |
164 | 164 | } |
165 | 165 | ); |
166 | 166 | |
167 | 167 | $this->app->bind( |
168 | 168 | 'piggybankform', |
169 | - static function () { |
|
169 | + static function() { |
|
170 | 170 | return new PiggyBankForm; |
171 | 171 | } |
172 | 172 | ); |
173 | 173 | |
174 | 174 | $this->app->bind( |
175 | 175 | 'ruleform', |
176 | - static function () { |
|
176 | + static function() { |
|
177 | 177 | return new RuleForm; |
178 | 178 | } |
179 | 179 | ); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | // chart builder |
185 | 185 | $this->app->bind( |
186 | 186 | MetaPieChartInterface::class, |
187 | - function (Application $app) { |
|
187 | + function(Application $app) { |
|
188 | 188 | /** @var MetaPieChart $chart */ |
189 | 189 | $chart = app(MetaPieChart::class); |
190 | 190 | if ($app->auth->check()) { |