mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-29 06:34:37 +00:00 
			
		
		
		
	Use PSR-12 code style
This commit is contained in:
		| @@ -55,8 +55,7 @@ class APIEventHandler | |||||||
|         $user       = $repository->find((int) $event->userId); |         $user       = $repository->find((int) $event->userId); | ||||||
|  |  | ||||||
|         if (null !== $user) { |         if (null !== $user) { | ||||||
|             Notification::send($user, new NewAccessToken); |             Notification::send($user, new NewAccessToken()); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,7 +29,6 @@ use FireflyIII\Repositories\AuditLogEntry\ALERepositoryInterface; | |||||||
|  |  | ||||||
| class AuditEventHandler | class AuditEventHandler | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @param TriggeredAuditLog $event |      * @param TriggeredAuditLog $event | ||||||
|      * @return void |      * @return void | ||||||
| @@ -47,5 +46,4 @@ class AuditEventHandler | |||||||
|         $repository = app(ALERepositoryInterface::class); |         $repository = app(ALERepositoryInterface::class); | ||||||
|         $repository->store($array); |         $repository->store($array); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -41,7 +41,6 @@ use Mail; | |||||||
|  */ |  */ | ||||||
| class AutomationHandler | class AutomationHandler | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Respond to the creation of X journals. |      * Respond to the creation of X journals. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -51,6 +51,6 @@ class DestroyedGroupEventHandler | |||||||
|         $engine->setTrigger(WebhookTrigger::DESTROY_TRANSACTION->value); |         $engine->setTrigger(WebhookTrigger::DESTROY_TRANSACTION->value); | ||||||
|         $engine->generateMessages(); |         $engine->generateMessages(); | ||||||
|  |  | ||||||
|         event(new RequestedSendWebhookMessages); |         event(new RequestedSendWebhookMessages()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -43,5 +43,4 @@ class StoredAccountEventHandler | |||||||
|         $object->setAccount($account); |         $object->setAccount($account); | ||||||
|         $object->recalculate(); |         $object->recalculate(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -118,7 +118,6 @@ class StoredGroupEventHandler | |||||||
|         $engine->generateMessages(); |         $engine->generateMessages(); | ||||||
|  |  | ||||||
|         // trigger event to send them: |         // trigger event to send them: | ||||||
|         event(new RequestedSendWebhookMessages); |         event(new RequestedSendWebhookMessages()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -24,7 +24,6 @@ declare(strict_types=1); | |||||||
|  |  | ||||||
| namespace FireflyIII\Handlers\Events; | namespace FireflyIII\Handlers\Events; | ||||||
|  |  | ||||||
|  |  | ||||||
| use FireflyIII\Events\UpdatedAccount; | use FireflyIII\Events\UpdatedAccount; | ||||||
| use FireflyIII\Services\Internal\Support\CreditRecalculateService; | use FireflyIII\Services\Internal\Support\CreditRecalculateService; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -110,7 +110,7 @@ class UpdatedGroupEventHandler | |||||||
|         $engine->setTrigger(WebhookTrigger::UPDATE_TRANSACTION->value); |         $engine->setTrigger(WebhookTrigger::UPDATE_TRANSACTION->value); | ||||||
|         $engine->generateMessages(); |         $engine->generateMessages(); | ||||||
|  |  | ||||||
|         event(new RequestedSendWebhookMessages); |         event(new RequestedSendWebhookMessages()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -155,6 +155,5 @@ class UpdatedGroupEventHandler | |||||||
|             Transaction::whereIn('transaction_journal_id', $all) |             Transaction::whereIn('transaction_journal_id', $all) | ||||||
|                        ->where('amount', '>', 0)->update(['account_id' => $destAccount->id]); |                        ->where('amount', '>', 0)->update(['account_id' => $destAccount->id]); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -89,7 +89,6 @@ class UserEventHandler | |||||||
|         $url     = route('invite', [$event->invitee->invite_code]); |         $url     = route('invite', [$event->invitee->invite_code]); | ||||||
|         try { |         try { | ||||||
|             Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url)); |             Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url)); | ||||||
|  |  | ||||||
|         } catch (Exception $e) { // @phpstan-ignore-line |         } catch (Exception $e) { // @phpstan-ignore-line | ||||||
|             Log::error($e->getMessage()); |             Log::error($e->getMessage()); | ||||||
|         } |         } | ||||||
| @@ -101,7 +100,7 @@ class UserEventHandler | |||||||
|      */ |      */ | ||||||
|     public function createExchangeRates(RegisteredUser $event): void |     public function createExchangeRates(RegisteredUser $event): void | ||||||
|     { |     { | ||||||
|         $seeder = new ExchangeRateSeeder; |         $seeder = new ExchangeRateSeeder(); | ||||||
|         $seeder->run(); |         $seeder->run(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -246,7 +245,6 @@ class UserEventHandler | |||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url)); |             Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url)); | ||||||
|  |  | ||||||
|         } catch (Exception $e) { // @phpstan-ignore-line |         } catch (Exception $e) { // @phpstan-ignore-line | ||||||
|             Log::error($e->getMessage()); |             Log::error($e->getMessage()); | ||||||
|         } |         } | ||||||
| @@ -270,7 +268,6 @@ class UserEventHandler | |||||||
|         $url      = route('profile.undo-email-change', [$token->data, $hashed]); |         $url      = route('profile.undo-email-change', [$token->data, $hashed]); | ||||||
|         try { |         try { | ||||||
|             Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url)); |             Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url)); | ||||||
|  |  | ||||||
|         } catch (Exception $e) { // @phpstan-ignore-line |         } catch (Exception $e) { // @phpstan-ignore-line | ||||||
|             Log::error($e->getMessage()); |             Log::error($e->getMessage()); | ||||||
|         } |         } | ||||||
| @@ -296,7 +293,7 @@ class UserEventHandler | |||||||
|     { |     { | ||||||
|         $sendMail = FireflyConfig::get('notification_user_new_reg', true)->data; |         $sendMail = FireflyConfig::get('notification_user_new_reg', true)->data; | ||||||
|         if ($sendMail) { |         if ($sendMail) { | ||||||
|             Notification::send($event->user, new UserRegistrationNotification); |             Notification::send($event->user, new UserRegistrationNotification()); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -374,6 +371,5 @@ class UserEventHandler | |||||||
|         if (false === $inArray && true === $send) { |         if (false === $inArray && true === $send) { | ||||||
|             event(new DetectedNewIPAddress($user, $ip)); |             event(new DetectedNewIPAddress($user, $ip)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -38,8 +38,7 @@ class WebhookEventHandler | |||||||
|     public function sendWebhookMessages(): void |     public function sendWebhookMessages(): void | ||||||
|     { |     { | ||||||
|         // kick off the job! |         // kick off the job! | ||||||
|         $messages = WebhookMessage |         $messages = WebhookMessage::where('webhook_messages.sent', 0) | ||||||
|             ::where('webhook_messages.sent', 0) |  | ||||||
|             //->where('webhook_messages.errored', 0) |             //->where('webhook_messages.errored', 0) | ||||||
|             ->get(['webhook_messages.*']) |             ->get(['webhook_messages.*']) | ||||||
|             ->filter( |             ->filter( | ||||||
|   | |||||||
| @@ -59,9 +59,9 @@ class AttachmentHelper implements AttachmentHelperInterface | |||||||
|     { |     { | ||||||
|         $this->maxUploadSize = (int) config('firefly.maxUploadSize'); |         $this->maxUploadSize = (int) config('firefly.maxUploadSize'); | ||||||
|         $this->allowedMimes  = (array) config('firefly.allowedMimes'); |         $this->allowedMimes  = (array) config('firefly.allowedMimes'); | ||||||
|         $this->errors        = new MessageBag; |         $this->errors        = new MessageBag(); | ||||||
|         $this->messages      = new MessageBag; |         $this->messages      = new MessageBag(); | ||||||
|         $this->attachments   = new Collection; |         $this->attachments   = new Collection(); | ||||||
|         $this->uploadDisk    = Storage::disk('upload'); |         $this->uploadDisk    = Storage::disk('upload'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -145,11 +145,9 @@ class AttachmentHelper implements AttachmentHelperInterface | |||||||
|     { |     { | ||||||
|         $resource = tmpfile(); |         $resource = tmpfile(); | ||||||
|         if (false === $resource) { |         if (false === $resource) { | ||||||
|  |  | ||||||
|             Log::error('Cannot create temp-file for file upload.'); |             Log::error('Cannot create temp-file for file upload.'); | ||||||
|  |  | ||||||
|             return false; |             return false; | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ('' === $content) { |         if ('' === $content) { | ||||||
| @@ -239,7 +237,7 @@ class AttachmentHelper implements AttachmentHelperInterface | |||||||
|                 $user = $model->account->user; |                 $user = $model->account->user; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             $attachment = new Attachment; // create Attachment object. |             $attachment = new Attachment(); // create Attachment object. | ||||||
|             $attachment->user()->associate($user); |             $attachment->user()->associate($user); | ||||||
|             $attachment->attachable()->associate($model); |             $attachment->attachable()->associate($model); | ||||||
|             $attachment->md5      = md5_file($file->getRealPath()); |             $attachment->md5      = md5_file($file->getRealPath()); | ||||||
|   | |||||||
| @@ -33,7 +33,6 @@ use Illuminate\Support\Collection; | |||||||
|  */ |  */ | ||||||
| trait AccountCollection | trait AccountCollection | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * These accounts must not be included. |      * These accounts must not be included. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -32,7 +32,6 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; | |||||||
|  */ |  */ | ||||||
| trait AmountCollection | trait AmountCollection | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Get transactions with a specific amount. |      * Get transactions with a specific amount. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -855,7 +855,7 @@ trait MetaCollection | |||||||
|         $filter              = function (int $index, array $object) use ($list): bool { |         $filter              = function (int $index, array $object) use ($list): bool { | ||||||
|             foreach ($object['transactions'] as $transaction) { |             foreach ($object['transactions'] as $transaction) { | ||||||
|                 foreach ($transaction['tags'] as $tag) { |                 foreach ($transaction['tags'] as $tag) { | ||||||
|                     if (in_array($tag['name'], $list)) { |                     if (in_array($tag['name'], $list, true)) { | ||||||
|                         return false; |                         return false; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -100,7 +100,6 @@ trait TimeCollection | |||||||
|         $this->postFilters[] = $filter; |         $this->postFilters[] = $filter; | ||||||
|  |  | ||||||
|         return $this; |         return $this; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -430,7 +429,6 @@ trait TimeCollection | |||||||
|     { |     { | ||||||
|         $this->query->whereMonth('transaction_journals.date', '>=', $month); |         $this->query->whereMonth('transaction_journals.date', '>=', $month); | ||||||
|         return $this; |         return $this; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -441,7 +439,6 @@ trait TimeCollection | |||||||
|     { |     { | ||||||
|         $this->query->whereMonth('transaction_journals.date', '<=', $month); |         $this->query->whereMonth('transaction_journals.date', '<=', $month); | ||||||
|         return $this; |         return $this; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -718,7 +715,6 @@ trait TimeCollection | |||||||
|         }; |         }; | ||||||
|         $this->postFilters[] = $filter; |         $this->postFilters[] = $filter; | ||||||
|         return $this; |         return $this; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -841,5 +837,4 @@ trait TimeCollection | |||||||
|         $this->query->whereYear('transaction_journals.date', '!=', $year); |         $this->query->whereYear('transaction_journals.date', '!=', $year); | ||||||
|         return $this; |         return $this; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -50,7 +50,12 @@ use Log; | |||||||
|  */ |  */ | ||||||
| class GroupCollector implements GroupCollectorInterface | class GroupCollector implements GroupCollectorInterface | ||||||
| { | { | ||||||
|     use CollectorProperties, AccountCollection, AmountCollection, TimeCollection, MetaCollection, AttachmentCollection; |     use CollectorProperties; | ||||||
|  |     use AccountCollection; | ||||||
|  |     use AmountCollection; | ||||||
|  |     use TimeCollection; | ||||||
|  |     use MetaCollection; | ||||||
|  |     use AttachmentCollection; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Group collector constructor. |      * Group collector constructor. | ||||||
| @@ -352,7 +357,6 @@ class GroupCollector implements GroupCollectorInterface | |||||||
|      */ |      */ | ||||||
|     public function excludeIds(array $groupIds): GroupCollectorInterface |     public function excludeIds(array $groupIds): GroupCollectorInterface | ||||||
|     { |     { | ||||||
|  |  | ||||||
|         $this->query->whereNotIn('transaction_groups.id', $groupIds); |         $this->query->whereNotIn('transaction_groups.id', $groupIds); | ||||||
|  |  | ||||||
|         return $this; |         return $this; | ||||||
| @@ -767,7 +771,7 @@ class GroupCollector implements GroupCollectorInterface | |||||||
|          * @var Closure $function |          * @var Closure $function | ||||||
|          */ |          */ | ||||||
|         foreach ($this->postFilters as $function) { |         foreach ($this->postFilters as $function) { | ||||||
|             $nextCollection = new Collection; |             $nextCollection = new Collection(); | ||||||
|             // loop everything in the current collection |             // loop everything in the current collection | ||||||
|             // and save it (or not) in the new collection. |             // and save it (or not) in the new collection. | ||||||
|             // that new collection is the next current collection |             // that new collection is the next current collection | ||||||
| @@ -874,7 +878,6 @@ class GroupCollector implements GroupCollectorInterface | |||||||
|      */ |      */ | ||||||
|     public function setIds(array $groupIds): GroupCollectorInterface |     public function setIds(array $groupIds): GroupCollectorInterface | ||||||
|     { |     { | ||||||
|  |  | ||||||
|         $this->query->whereIn('transaction_groups.id', $groupIds); |         $this->query->whereIn('transaction_groups.id', $groupIds); | ||||||
|  |  | ||||||
|         return $this; |         return $this; | ||||||
| @@ -992,7 +995,6 @@ class GroupCollector implements GroupCollectorInterface | |||||||
|         if (null === $this->user) { |         if (null === $this->user) { | ||||||
|             $this->user = $user; |             $this->user = $user; | ||||||
|             $this->startQuery(); |             $this->startQuery(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $this; |         return $this; | ||||||
|   | |||||||
| @@ -1395,6 +1395,4 @@ interface GroupCollectorInterface | |||||||
|      * @return GroupCollectorInterface |      * @return GroupCollectorInterface | ||||||
|      */ |      */ | ||||||
|     public function yearIsNot(string $year): GroupCollectorInterface; |     public function yearIsNot(string $year): GroupCollectorInterface; | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ class NetWorth implements NetWorthInterface | |||||||
|     public function getNetWorthByCurrency(Collection $accounts, Carbon $date): array |     public function getNetWorthByCurrency(Collection $accounts, Carbon $date): array | ||||||
|     { |     { | ||||||
|         // start in the past, end in the future? use $date |         // start in the past, end in the future? use $date | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($date); |         $cache->addProperty($date); | ||||||
|         $cache->addProperty('net-worth-by-currency'); |         $cache->addProperty('net-worth-by-currency'); | ||||||
|         $cache->addProperty(implode(',', $accounts->pluck('id')->toArray())); |         $cache->addProperty(implode(',', $accounts->pluck('id')->toArray())); | ||||||
| @@ -184,7 +184,7 @@ class NetWorth implements NetWorthInterface | |||||||
|     private function getAccounts(): Collection |     private function getAccounts(): Collection | ||||||
|     { |     { | ||||||
|         $accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::DEFAULT, AccountType::CREDITCARD]); |         $accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::DEFAULT, AccountType::CREDITCARD]); | ||||||
|         $filtered = new Collection; |         $filtered = new Collection(); | ||||||
|         /** @var Account $account */ |         /** @var Account $account */ | ||||||
|         foreach ($accounts as $account) { |         foreach ($accounts as $account) { | ||||||
|             if (1 === (int) $this->accountRepository->getMetaValue($account, 'include_net_worth')) { |             if (1 === (int) $this->accountRepository->getMetaValue($account, 'include_net_worth')) { | ||||||
|   | |||||||
| @@ -66,5 +66,4 @@ interface NetWorthInterface | |||||||
|      * @return array |      * @return array | ||||||
|      */ |      */ | ||||||
|     public function sumNetWorthByCurrency(Carbon $date): array; |     public function sumNetWorthByCurrency(Carbon $date): array; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,7 +31,6 @@ use FireflyIII\Models\Category; | |||||||
|  */ |  */ | ||||||
| interface PopupReportInterface | interface PopupReportInterface | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Get balances for budget. |      * Get balances for budget. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -28,7 +28,6 @@ use FireflyIII\Models\WebhookMessage; | |||||||
| use JsonException; | use JsonException; | ||||||
| use Log; | use Log; | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Class Sha3SignatureGenerator |  * Class Sha3SignatureGenerator | ||||||
|  */ |  */ | ||||||
|   | |||||||
| @@ -113,5 +113,4 @@ class DeleteController extends Controller | |||||||
|  |  | ||||||
|         return redirect($this->getPreviousUrl('accounts.delete.url')); |         return redirect($this->getPreviousUrl('accounts.delete.url')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -120,7 +120,6 @@ class IndexController extends Controller | |||||||
|         $accounts->setPath(route('accounts.inactive.index', [$objectType])); |         $accounts->setPath(route('accounts.inactive.index', [$objectType])); | ||||||
|  |  | ||||||
|         return view('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts')); |         return view('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts')); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -96,11 +96,9 @@ class ReconcileController extends Controller | |||||||
|             return $this->redirectAccountToAccount($account); |             return $this->redirectAccountToAccount($account); | ||||||
|         } |         } | ||||||
|         if (AccountType::ASSET !== $account->accountType->type) { |         if (AccountType::ASSET !== $account->accountType->type) { | ||||||
|  |  | ||||||
|             session()->flash('error', (string) trans('firefly.must_be_asset_account')); |             session()->flash('error', (string) trans('firefly.must_be_asset_account')); | ||||||
|  |  | ||||||
|             return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))])); |             return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))])); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|         $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); |         $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); | ||||||
|  |  | ||||||
| @@ -110,11 +108,10 @@ class ReconcileController extends Controller | |||||||
|         // get start and end |         // get start and end | ||||||
|  |  | ||||||
|         if (null === $start && null === $end) { |         if (null === $start && null === $end) { | ||||||
|  |  | ||||||
|             /** @var Carbon $start */ |             /** @var Carbon $start */ | ||||||
|             $start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range)); |             $start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range)); | ||||||
|             /** @var Carbon $end */ |             /** @var Carbon $end */ | ||||||
|             $end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range)); |             $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range)); | ||||||
|         } |         } | ||||||
|         if (null === $end) { |         if (null === $end) { | ||||||
|             /** @var Carbon $end */ |             /** @var Carbon $end */ | ||||||
|   | |||||||
| @@ -188,7 +188,7 @@ class ShowController extends Controller | |||||||
|         $pageSize     = (int) app('preferences')->get('listPageSize', 50)->data; |         $pageSize     = (int) app('preferences')->get('listPageSize', 50)->data; | ||||||
|         $currency     = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); |         $currency     = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); | ||||||
|         $subTitle     = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); |         $subTitle     = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); | ||||||
|         $periods      = new Collection; |         $periods      = new Collection(); | ||||||
|         /** @var GroupCollectorInterface $collector */ |         /** @var GroupCollectorInterface $collector */ | ||||||
|         $collector = app(GroupCollectorInterface::class); |         $collector = app(GroupCollectorInterface::class); | ||||||
|         $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); |         $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); | ||||||
|   | |||||||
| @@ -246,11 +246,9 @@ class UserController extends Controller | |||||||
|         app('preferences')->mark(); |         app('preferences')->mark(); | ||||||
|         $redirect = redirect($this->getPreviousUrl('users.edit.url')); |         $redirect = redirect($this->getPreviousUrl('users.edit.url')); | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             session()->put('users.edit.fromUpdate', true); |             session()->put('users.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]); |             $redirect = redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // redirect to previous URL. |         // redirect to previous URL. | ||||||
|   | |||||||
| @@ -40,7 +40,6 @@ use Illuminate\View\View; | |||||||
|  */ |  */ | ||||||
| class AttachmentController extends Controller | class AttachmentController extends Controller | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** @var AttachmentRepositoryInterface Attachment repository */ |     /** @var AttachmentRepositoryInterface Attachment repository */ | ||||||
|     private $repository; |     private $repository; | ||||||
|  |  | ||||||
| @@ -198,11 +197,9 @@ class AttachmentController extends Controller | |||||||
|  |  | ||||||
|         $redirect = redirect($this->getPreviousUrl('attachments.edit.url')); |         $redirect = redirect($this->getPreviousUrl('attachments.edit.url')); | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             $request->session()->put('attachments.edit.fromUpdate', true); |             $request->session()->put('attachments.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]); |             $redirect = redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // redirect to previous URL. |         // redirect to previous URL. | ||||||
|   | |||||||
| @@ -52,7 +52,8 @@ use Log; | |||||||
|  */ |  */ | ||||||
| class LoginController extends Controller | class LoginController extends Controller | ||||||
| { | { | ||||||
|     use AuthenticatesUsers, ThrottlesLogins; |     use AuthenticatesUsers; | ||||||
|  |     use ThrottlesLogins; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Where to redirect users after login. |      * Where to redirect users after login. | ||||||
|   | |||||||
| @@ -51,7 +51,8 @@ use Psr\Container\NotFoundExceptionInterface; | |||||||
|  */ |  */ | ||||||
| class RegisterController extends Controller | class RegisterController extends Controller | ||||||
| { | { | ||||||
|     use RegistersUsers, CreateStuff; |     use RegistersUsers; | ||||||
|  |     use CreateStuff; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Where to redirect users after registration. |      * Where to redirect users after registration. | ||||||
| @@ -74,7 +75,6 @@ class RegisterController extends Controller | |||||||
|         if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { |         if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { | ||||||
|             throw new FireflyException('Using external identity provider. Cannot continue.'); |             throw new FireflyException('Using external identity provider. Cannot continue.'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -191,7 +191,7 @@ class RegisterController extends Controller | |||||||
|  |  | ||||||
|             return view('error', compact('message')); |             return view('error', compact('message')); | ||||||
|         } |         } | ||||||
|         if(false === $validCode) { |         if (false === $validCode) { | ||||||
|             $message = 'Invalid code.'; |             $message = 'Invalid code.'; | ||||||
|  |  | ||||||
|             return view('error', compact('message')); |             return view('error', compact('message')); | ||||||
|   | |||||||
| @@ -144,11 +144,9 @@ class EditController extends Controller | |||||||
|         $redirect = redirect($this->getPreviousUrl('bills.edit.url')); |         $redirect = redirect($this->getPreviousUrl('bills.edit.url')); | ||||||
|  |  | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             $request->session()->put('bills.edit.fromUpdate', true); |             $request->session()->put('bills.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]); |             $redirect = redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
|   | |||||||
| @@ -77,7 +77,7 @@ class IndexController extends Controller | |||||||
|         $total      = $collection->count(); |         $total      = $collection->count(); | ||||||
|  |  | ||||||
|         $defaultCurrency = app('amount')->getDefaultCurrency(); |         $defaultCurrency = app('amount')->getDefaultCurrency(); | ||||||
|         $parameters      = new ParameterBag; |         $parameters      = new ParameterBag(); | ||||||
|         $parameters->set('start', $start); |         $parameters->set('start', $start); | ||||||
|         $parameters->set('end', $end); |         $parameters->set('end', $end); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ class ShowController extends Controller | |||||||
|  |  | ||||||
|             return redirect(route('bills.show', [$bill->id])); |             return redirect(route('bills.show', [$bill->id])); | ||||||
|         } |         } | ||||||
|         $set = new Collection; |         $set = new Collection(); | ||||||
|         if (true === $bill->active) { |         if (true === $bill->active) { | ||||||
|             $set   = $this->repository->getRulesForBill($bill); |             $set   = $this->repository->getRulesForBill($bill); | ||||||
|             $total = 0; |             $total = 0; | ||||||
| @@ -167,7 +167,7 @@ class ShowController extends Controller | |||||||
|  |  | ||||||
|         // transform any attachments as well. |         // transform any attachments as well. | ||||||
|         $collection  = $this->repository->getAttachments($bill); |         $collection  = $this->repository->getAttachments($bill); | ||||||
|         $attachments = new Collection; |         $attachments = new Collection(); | ||||||
|  |  | ||||||
|  |  | ||||||
|         if ($collection->count() > 0) { |         if ($collection->count() > 0) { | ||||||
| @@ -183,5 +183,4 @@ class ShowController extends Controller | |||||||
|  |  | ||||||
|         return view('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle')); |         return view('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -160,7 +160,7 @@ class BudgetLimitController extends Controller | |||||||
|         if ((int) $amount > 268435456) { |         if ((int) $amount > 268435456) { | ||||||
|             $amount = '268435456'; |             $amount = '268435456'; | ||||||
|         } |         } | ||||||
|         if((float) $amount < 0.0) { |         if ((float) $amount < 0.0) { | ||||||
|             $amount = bcmul($amount, '-1'); |             $amount = bcmul($amount, '-1'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -229,7 +229,7 @@ class BudgetLimitController extends Controller | |||||||
|         if ((int) $amount > 268435456) { // 268 million |         if ((int) $amount > 268435456) { // 268 million | ||||||
|             $amount = '268435456'; |             $amount = '268435456'; | ||||||
|         } |         } | ||||||
|         if((float) $amount < 0.0) { |         if ((float) $amount < 0.0) { | ||||||
|             $amount = bcmul($amount, '-1'); |             $amount = bcmul($amount, '-1'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -139,11 +139,9 @@ class CreateController extends Controller | |||||||
|         $redirect = redirect($this->getPreviousUrl('budgets.create.url')); |         $redirect = redirect($this->getPreviousUrl('budgets.create.url')); | ||||||
|  |  | ||||||
|         if (1 === (int) $request->get('create_another')) { |         if (1 === (int) $request->get('create_another')) { | ||||||
|  |  | ||||||
|             $request->session()->put('budgets.create.fromStore', true); |             $request->session()->put('budgets.create.fromStore', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('budgets.create'))->withInput(); |             $redirect = redirect(route('budgets.create'))->withInput(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
|   | |||||||
| @@ -95,5 +95,4 @@ class DeleteController extends Controller | |||||||
|  |  | ||||||
|         return redirect($this->getPreviousUrl('budgets.delete.url')); |         return redirect($this->getPreviousUrl('budgets.delete.url')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -149,11 +149,9 @@ class EditController extends Controller | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             $request->session()->put('budgets.edit.fromUpdate', true); |             $request->session()->put('budgets.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]); |             $redirect = redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
|   | |||||||
| @@ -123,7 +123,7 @@ class IndexController extends Controller | |||||||
|  |  | ||||||
|         // get budgeted for default currency: |         // get budgeted for default currency: | ||||||
|         if (empty($availableBudgets)) { |         if (empty($availableBudgets)) { | ||||||
|             $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,); |             $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, ); | ||||||
|             $spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency); |             $spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency); | ||||||
|             $spent    = $spentArr[$defaultCurrency->id]['sum'] ?? '0'; |             $spent    = $spentArr[$defaultCurrency->id]['sum'] ?? '0'; | ||||||
|             unset($spentArr); |             unset($spentArr); | ||||||
| @@ -137,10 +137,25 @@ class IndexController extends Controller | |||||||
|         $inactive = $this->repository->getInactiveBudgets(); |         $inactive = $this->repository->getInactiveBudgets(); | ||||||
|  |  | ||||||
|         return view( |         return view( | ||||||
|             'budgets.index', compact( |             'budgets.index', | ||||||
|                                'availableBudgets', 'budgeted', 'spent', 'prevLoop', 'nextLoop', 'budgets', 'currencies', 'periodTitle', |             compact( | ||||||
|                                'defaultCurrency', 'activeDaysPassed', 'activeDaysLeft', 'inactive', 'budgets', 'start', 'end', 'sums' |                 'availableBudgets', | ||||||
|                            ) |                 'budgeted', | ||||||
|  |                 'spent', | ||||||
|  |                 'prevLoop', | ||||||
|  |                 'nextLoop', | ||||||
|  |                 'budgets', | ||||||
|  |                 'currencies', | ||||||
|  |                 'periodTitle', | ||||||
|  |                 'defaultCurrency', | ||||||
|  |                 'activeDaysPassed', | ||||||
|  |                 'activeDaysLeft', | ||||||
|  |                 'inactive', | ||||||
|  |                 'budgets', | ||||||
|  |                 'start', | ||||||
|  |                 'end', | ||||||
|  |                 'sums' | ||||||
|  |             ) | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -167,7 +182,7 @@ class IndexController extends Controller | |||||||
|             $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0'; |             $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0'; | ||||||
|  |  | ||||||
|             // budgeted in period: |             // budgeted in period: | ||||||
|             $budgeted           = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,); |             $budgeted           = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, ); | ||||||
|             $array['budgeted']  = $budgeted; |             $array['budgeted']  = $budgeted; | ||||||
|             $availableBudgets[] = $array; |             $availableBudgets[] = $array; | ||||||
|             unset($spentArr); |             unset($spentArr); | ||||||
|   | |||||||
| @@ -44,7 +44,8 @@ use Illuminate\View\View; | |||||||
|  */ |  */ | ||||||
| class ShowController extends Controller | class ShowController extends Controller | ||||||
| { | { | ||||||
|     use PeriodOverview, AugumentData; |     use PeriodOverview; | ||||||
|  |     use AugumentData; | ||||||
|  |  | ||||||
|     protected JournalRepositoryInterface $journalRepos; |     protected JournalRepositoryInterface $journalRepos; | ||||||
|     private BudgetRepositoryInterface    $repository; |     private BudgetRepositoryInterface    $repository; | ||||||
| @@ -123,10 +124,9 @@ class ShowController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function noBudgetAll(Request $request) |     public function noBudgetAll(Request $request) | ||||||
|     { |     { | ||||||
|  |  | ||||||
|         $subTitle = (string) trans('firefly.all_journals_without_budget'); |         $subTitle = (string) trans('firefly.all_journals_without_budget'); | ||||||
|         $first    = $this->journalRepos->firstNull(); |         $first    = $this->journalRepos->firstNull(); | ||||||
|         $start    = null === $first ? new Carbon : $first->date; |         $start    = null === $first ? new Carbon() : $first->date; | ||||||
|         $end      = today(config('app.timezone')); |         $end      = today(config('app.timezone')); | ||||||
|         $page     = (int) $request->get('page'); |         $page     = (int) $request->get('page'); | ||||||
|         $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; |         $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; | ||||||
|   | |||||||
| @@ -112,11 +112,9 @@ class CreateController extends Controller | |||||||
|  |  | ||||||
|         $redirect = redirect(route('categories.index')); |         $redirect = redirect(route('categories.index')); | ||||||
|         if (1 === (int) $request->get('create_another')) { |         if (1 === (int) $request->get('create_another')) { | ||||||
|  |  | ||||||
|             $request->session()->put('categories.create.fromStore', true); |             $request->session()->put('categories.create.fromStore', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('categories.create'))->withInput(); |             $redirect = redirect(route('categories.create'))->withInput(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
|   | |||||||
| @@ -39,7 +39,6 @@ use Illuminate\View\View; | |||||||
|  */ |  */ | ||||||
| class EditController extends Controller | class EditController extends Controller | ||||||
| { | { | ||||||
|  |  | ||||||
|     private AttachmentHelperInterface   $attachments; |     private AttachmentHelperInterface   $attachments; | ||||||
|     private CategoryRepositoryInterface $repository; |     private CategoryRepositoryInterface $repository; | ||||||
|  |  | ||||||
| @@ -120,11 +119,9 @@ class EditController extends Controller | |||||||
|         $redirect = redirect($this->getPreviousUrl('categories.edit.url')); |         $redirect = redirect($this->getPreviousUrl('categories.edit.url')); | ||||||
|  |  | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             $request->session()->put('categories.edit.fromUpdate', true); |             $request->session()->put('categories.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('categories.edit', [$category->id])); |             $redirect = redirect(route('categories.edit', [$category->id])); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ class IndexController extends Controller | |||||||
|  |  | ||||||
|         $collection->each( |         $collection->each( | ||||||
|             function (Category $category) { |             function (Category $category) { | ||||||
|                 $category->lastActivity = $this->repository->lastUseDate($category, new Collection); |                 $category->lastActivity = $this->repository->lastUseDate($category, new Collection()); | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
| @@ -91,5 +91,4 @@ class IndexController extends Controller | |||||||
|  |  | ||||||
|         return view('categories.index', compact('categories')); |         return view('categories.index', compact('categories')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -125,13 +125,13 @@ class NoCategoryController extends Controller | |||||||
|         // default values: |         // default values: | ||||||
|         $start    = null; |         $start    = null; | ||||||
|         $end      = null; |         $end      = null; | ||||||
|         $periods  = new Collection; |         $periods  = new Collection(); | ||||||
|         $page     = (int) $request->get('page'); |         $page     = (int) $request->get('page'); | ||||||
|         $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; |         $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; | ||||||
|         Log::debug('Start of noCategory()'); |         Log::debug('Start of noCategory()'); | ||||||
|         $subTitle = (string) trans('firefly.all_journals_without_category'); |         $subTitle = (string) trans('firefly.all_journals_without_category'); | ||||||
|         $first    = $this->journalRepos->firstNull(); |         $first    = $this->journalRepos->firstNull(); | ||||||
|         $start    = null === $first ? new Carbon : $first->date; |         $start    = null === $first ? new Carbon() : $first->date; | ||||||
|         $end      = today(config('app.timezone')); |         $end      = today(config('app.timezone')); | ||||||
|         Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d'))); |         Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d'))); | ||||||
|         Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d'))); |         Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d'))); | ||||||
|   | |||||||
| @@ -132,7 +132,7 @@ class ShowController extends Controller | |||||||
|         $pageSize     = (int) app('preferences')->get('listPageSize', 50)->data; |         $pageSize     = (int) app('preferences')->get('listPageSize', 50)->data; | ||||||
|         $start        = null; |         $start        = null; | ||||||
|         $end          = null; |         $end          = null; | ||||||
|         $periods      = new Collection; |         $periods      = new Collection(); | ||||||
|  |  | ||||||
|         $subTitle = (string) trans('firefly.all_journals_for_category', ['name' => $category->name]); |         $subTitle = (string) trans('firefly.all_journals_for_category', ['name' => $category->name]); | ||||||
|         $first    = $this->repository->firstUseDate($category); |         $first    = $this->repository->firstUseDate($category); | ||||||
|   | |||||||
| @@ -48,7 +48,9 @@ use Log; | |||||||
|  */ |  */ | ||||||
| class AccountController extends Controller | class AccountController extends Controller | ||||||
| { | { | ||||||
|     use DateCalculation, AugumentData, ChartGeneration; |     use DateCalculation; | ||||||
|  |     use AugumentData; | ||||||
|  |     use ChartGeneration; | ||||||
|  |  | ||||||
|     protected GeneratorInterface        $generator; |     protected GeneratorInterface        $generator; | ||||||
|     private AccountRepositoryInterface  $accountRepository; |     private AccountRepositoryInterface  $accountRepository; | ||||||
| @@ -88,7 +90,7 @@ class AccountController extends Controller | |||||||
|         $start = clone session('start', Carbon::now()->startOfMonth()); |         $start = clone session('start', Carbon::now()->startOfMonth()); | ||||||
|         /** @var Carbon $end */ |         /** @var Carbon $end */ | ||||||
|         $end   = clone session('end', Carbon::now()->endOfMonth()); |         $end   = clone session('end', Carbon::now()->endOfMonth()); | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.account.expense-accounts'); |         $cache->addProperty('chart.account.expense-accounts'); | ||||||
| @@ -196,7 +198,7 @@ class AccountController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function expenseBudget(Account $account, Carbon $start, Carbon $end): JsonResponse |     public function expenseBudget(Account $account, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($account->id); |         $cache->addProperty($account->id); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
| @@ -271,7 +273,7 @@ class AccountController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function expenseCategory(Account $account, Carbon $start, Carbon $end): JsonResponse |     public function expenseCategory(Account $account, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($account->id); |         $cache->addProperty($account->id); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
| @@ -372,7 +374,7 @@ class AccountController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function incomeCategory(Account $account, Carbon $start, Carbon $end): JsonResponse |     public function incomeCategory(Account $account, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($account->id); |         $cache->addProperty($account->id); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
| @@ -432,7 +434,7 @@ class AccountController extends Controller | |||||||
|     public function period(Account $account, Carbon $start, Carbon $end): JsonResponse |     public function period(Account $account, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $chartData = []; |         $chartData = []; | ||||||
|         $cache     = new CacheProperties; |         $cache     = new CacheProperties(); | ||||||
|         $cache->addProperty('chart.account.period'); |         $cache->addProperty('chart.account.period'); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
| @@ -508,7 +510,6 @@ class AccountController extends Controller | |||||||
|                     $current         = app('navigation')->addPeriod($current, $step, 0); |                     $current         = app('navigation')->addPeriod($current, $step, 0); | ||||||
|                 } |                 } | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|         } |         } | ||||||
|         $result['entries'] = $entries; |         $result['entries'] = $entries; | ||||||
|  |  | ||||||
| @@ -547,7 +548,7 @@ class AccountController extends Controller | |||||||
|         $start = clone session('start', Carbon::now()->startOfMonth()); |         $start = clone session('start', Carbon::now()->startOfMonth()); | ||||||
|         /** @var Carbon $end */ |         /** @var Carbon $end */ | ||||||
|         $end   = clone session('end', Carbon::now()->endOfMonth()); |         $end   = clone session('end', Carbon::now()->endOfMonth()); | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.account.revenue-accounts'); |         $cache->addProperty('chart.account.revenue-accounts'); | ||||||
|   | |||||||
| @@ -62,7 +62,7 @@ class BillController extends Controller | |||||||
|     { |     { | ||||||
|         $start = session('start', Carbon::now()->startOfMonth()); |         $start = session('start', Carbon::now()->startOfMonth()); | ||||||
|         $end   = session('end', Carbon::now()->endOfMonth()); |         $end   = session('end', Carbon::now()->endOfMonth()); | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.bill.frontpage'); |         $cache->addProperty('chart.bill.frontpage'); | ||||||
| @@ -106,7 +106,7 @@ class BillController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function single(Bill $bill): JsonResponse |     public function single(Bill $bill): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty('chart.bill.single'); |         $cache->addProperty('chart.bill.single'); | ||||||
|         $cache->addProperty($bill->id); |         $cache->addProperty($bill->id); | ||||||
|         if ($cache->has()) { |         if ($cache->has()) { | ||||||
|   | |||||||
| @@ -49,7 +49,8 @@ use JsonException; | |||||||
|  */ |  */ | ||||||
| class BudgetController extends Controller | class BudgetController extends Controller | ||||||
| { | { | ||||||
|     use DateCalculation, AugumentData; |     use DateCalculation; | ||||||
|  |     use AugumentData; | ||||||
|  |  | ||||||
|     protected GeneratorInterface            $generator; |     protected GeneratorInterface            $generator; | ||||||
|     protected OperationsRepositoryInterface $opsRepository; |     protected OperationsRepositoryInterface $opsRepository; | ||||||
| @@ -209,7 +210,7 @@ class BudgetController extends Controller | |||||||
|         /** @var GroupCollectorInterface $collector */ |         /** @var GroupCollectorInterface $collector */ | ||||||
|         $collector     = app(GroupCollectorInterface::class); |         $collector     = app(GroupCollectorInterface::class); | ||||||
|         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; |         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; | ||||||
|         $cache         = new CacheProperties; |         $cache         = new CacheProperties(); | ||||||
|         $cache->addProperty($budget->id); |         $cache->addProperty($budget->id); | ||||||
|         $cache->addProperty($budgetLimitId); |         $cache->addProperty($budgetLimitId); | ||||||
|         $cache->addProperty('chart.budget.expense-asset'); |         $cache->addProperty('chart.budget.expense-asset'); | ||||||
| @@ -277,7 +278,7 @@ class BudgetController extends Controller | |||||||
|         /** @var GroupCollectorInterface $collector */ |         /** @var GroupCollectorInterface $collector */ | ||||||
|         $collector     = app(GroupCollectorInterface::class); |         $collector     = app(GroupCollectorInterface::class); | ||||||
|         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; |         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; | ||||||
|         $cache         = new CacheProperties; |         $cache         = new CacheProperties(); | ||||||
|         $cache->addProperty($budget->id); |         $cache->addProperty($budget->id); | ||||||
|         $cache->addProperty($budgetLimitId); |         $cache->addProperty($budgetLimitId); | ||||||
|         $cache->addProperty('chart.budget.expense-category'); |         $cache->addProperty('chart.budget.expense-category'); | ||||||
| @@ -341,7 +342,7 @@ class BudgetController extends Controller | |||||||
|         /** @var GroupCollectorInterface $collector */ |         /** @var GroupCollectorInterface $collector */ | ||||||
|         $collector     = app(GroupCollectorInterface::class); |         $collector     = app(GroupCollectorInterface::class); | ||||||
|         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; |         $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; | ||||||
|         $cache         = new CacheProperties; |         $cache         = new CacheProperties(); | ||||||
|         $cache->addProperty($budget->id); |         $cache->addProperty($budget->id); | ||||||
|         $cache->addProperty($budgetLimitId); |         $cache->addProperty($budgetLimitId); | ||||||
|         $cache->addProperty('chart.budget.expense-expense'); |         $cache->addProperty('chart.budget.expense-expense'); | ||||||
|   | |||||||
| @@ -41,7 +41,8 @@ use Illuminate\Support\Collection; | |||||||
|  */ |  */ | ||||||
| class BudgetReportController extends Controller | class BudgetReportController extends Controller | ||||||
| { | { | ||||||
|     use AugumentData, TransactionCalculation; |     use AugumentData; | ||||||
|  |     use TransactionCalculation; | ||||||
|  |  | ||||||
|     /** @var GeneratorInterface Chart generation methods. */ |     /** @var GeneratorInterface Chart generation methods. */ | ||||||
|     private $generator; |     private $generator; | ||||||
|   | |||||||
| @@ -46,7 +46,9 @@ use JsonException; | |||||||
|  */ |  */ | ||||||
| class CategoryController extends Controller | class CategoryController extends Controller | ||||||
| { | { | ||||||
|     use DateCalculation, AugumentData, ChartGeneration; |     use DateCalculation; | ||||||
|  |     use AugumentData; | ||||||
|  |     use ChartGeneration; | ||||||
|  |  | ||||||
|     /** @var GeneratorInterface Chart generation methods. */ |     /** @var GeneratorInterface Chart generation methods. */ | ||||||
|     protected $generator; |     protected $generator; | ||||||
| @@ -77,7 +79,7 @@ class CategoryController extends Controller | |||||||
|     public function all(Category $category): JsonResponse |     public function all(Category $category): JsonResponse | ||||||
|     { |     { | ||||||
|         // cache results: |         // cache results: | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty('chart.category.all'); |         $cache->addProperty('chart.category.all'); | ||||||
|         $cache->addProperty($category->id); |         $cache->addProperty($category->id); | ||||||
|         if ($cache->has()) { |         if ($cache->has()) { | ||||||
| @@ -125,7 +127,7 @@ class CategoryController extends Controller | |||||||
|         $start = session('start', Carbon::now()->startOfMonth()); |         $start = session('start', Carbon::now()->startOfMonth()); | ||||||
|         $end   = session('end', Carbon::now()->endOfMonth()); |         $end   = session('end', Carbon::now()->endOfMonth()); | ||||||
|         // chart properties for cache: |         // chart properties for cache: | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.category.frontpage'); |         $cache->addProperty('chart.category.frontpage'); | ||||||
| @@ -154,7 +156,7 @@ class CategoryController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end): JsonResponse |     public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.category.period'); |         $cache->addProperty('chart.category.period'); | ||||||
| @@ -202,7 +204,6 @@ class CategoryController extends Controller | |||||||
|             $collection = new Collection([$category]); |             $collection = new Collection([$category]); | ||||||
|             $expenses   = $opsRepository->listExpenses($start, $end, null, $collection); |             $expenses   = $opsRepository->listExpenses($start, $end, null, $collection); | ||||||
|             $income     = $opsRepository->listIncome($start, $end, null, $collection); |             $income     = $opsRepository->listIncome($start, $end, null, $collection); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|         $currencies = array_unique(array_merge(array_keys($income), array_keys($expenses))); |         $currencies = array_unique(array_merge(array_keys($income), array_keys($expenses))); | ||||||
|         $periods    = app('navigation')->listOfPeriods($start, $end); |         $periods    = app('navigation')->listOfPeriods($start, $end); | ||||||
| @@ -269,7 +270,7 @@ class CategoryController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end): JsonResponse |     public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty('chart.category.period.no-cat'); |         $cache->addProperty('chart.category.period.no-cat'); | ||||||
| @@ -305,7 +306,7 @@ class CategoryController extends Controller | |||||||
|             [$end, $start] = [$start, $end]; |             [$end, $start] = [$start, $end]; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty($start); |         $cache->addProperty($start); | ||||||
|         $cache->addProperty($end); |         $cache->addProperty($end); | ||||||
|         $cache->addProperty($category->id); |         $cache->addProperty($category->id); | ||||||
|   | |||||||
| @@ -39,7 +39,8 @@ use Illuminate\Support\Collection; | |||||||
|  */ |  */ | ||||||
| class CategoryReportController extends Controller | class CategoryReportController extends Controller | ||||||
| { | { | ||||||
|     use AugumentData, TransactionCalculation; |     use AugumentData; | ||||||
|  |     use TransactionCalculation; | ||||||
|  |  | ||||||
|     /** @var GeneratorInterface Chart generation methods. */ |     /** @var GeneratorInterface Chart generation methods. */ | ||||||
|     private $generator; |     private $generator; | ||||||
|   | |||||||
| @@ -38,7 +38,6 @@ use Illuminate\Support\Collection; | |||||||
|  */ |  */ | ||||||
| class DoubleReportController extends Controller | class DoubleReportController extends Controller | ||||||
| { | { | ||||||
|  |  | ||||||
|     /** @var GeneratorInterface Chart generation methods. */ |     /** @var GeneratorInterface Chart generation methods. */ | ||||||
|     private $generator; |     private $generator; | ||||||
|     /** @var OperationsRepositoryInterface */ |     /** @var OperationsRepositoryInterface */ | ||||||
|   | |||||||
| @@ -42,7 +42,8 @@ use JsonException; | |||||||
|  */ |  */ | ||||||
| class ExpenseReportController extends Controller | class ExpenseReportController extends Controller | ||||||
| { | { | ||||||
|     use AugumentData, TransactionCalculation; |     use AugumentData; | ||||||
|  |     use TransactionCalculation; | ||||||
|  |  | ||||||
|     /** @var AccountRepositoryInterface The account repository */ |     /** @var AccountRepositoryInterface The account repository */ | ||||||
|     protected $accountRepository; |     protected $accountRepository; | ||||||
| @@ -82,7 +83,7 @@ class ExpenseReportController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse |     public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse | ||||||
|     { |     { | ||||||
|         $cache = new CacheProperties; |         $cache = new CacheProperties(); | ||||||
|         $cache->addProperty('chart.expense.report.main'); |         $cache->addProperty('chart.expense.report.main'); | ||||||
|         $cache->addProperty($accounts); |         $cache->addProperty($accounts); | ||||||
|         $cache->addProperty($expense); |         $cache->addProperty($expense); | ||||||
| @@ -98,7 +99,7 @@ class ExpenseReportController extends Controller | |||||||
|         $currentStart = clone $start; |         $currentStart = clone $start; | ||||||
|         $combined     = $this->combineAccounts($expense); |         $combined     = $this->combineAccounts($expense); | ||||||
|         // make "all" set: |         // make "all" set: | ||||||
|         $all = new Collection; |         $all = new Collection(); | ||||||
|         foreach ($combined as $name => $combination) { |         foreach ($combined as $name => $combination) { | ||||||
|             $all = $all->merge($combination); |             $all = $all->merge($combination); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -36,7 +36,11 @@ use Route; | |||||||
|  */ |  */ | ||||||
| abstract class Controller extends BaseController | abstract class Controller extends BaseController | ||||||
| { | { | ||||||
|     use AuthorizesRequests, DispatchesJobs, ValidatesRequests, RequestInformation, UserNavigation; |     use AuthorizesRequests; | ||||||
|  |     use DispatchesJobs; | ||||||
|  |     use ValidatesRequests; | ||||||
|  |     use RequestInformation; | ||||||
|  |     use UserNavigation; | ||||||
|  |  | ||||||
|     protected string $dateTimeFormat; |     protected string $dateTimeFormat; | ||||||
|     protected string $monthAndDayFormat; |     protected string $monthAndDayFormat; | ||||||
|   | |||||||
| @@ -139,12 +139,10 @@ class CurrencyController extends Controller | |||||||
|         /** @var User $user */ |         /** @var User $user */ | ||||||
|         $user = auth()->user(); |         $user = auth()->user(); | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); |             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); | ||||||
|             Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); |             Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); | ||||||
|  |  | ||||||
|             return redirect(route('currencies.index')); |             return redirect(route('currencies.index')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ($this->repository->currencyInUse($currency)) { |         if ($this->repository->currencyInUse($currency)) { | ||||||
| @@ -177,12 +175,10 @@ class CurrencyController extends Controller | |||||||
|         /** @var User $user */ |         /** @var User $user */ | ||||||
|         $user = auth()->user(); |         $user = auth()->user(); | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); |             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); | ||||||
|             Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); |             Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); | ||||||
|  |  | ||||||
|             return redirect(route('currencies.index')); |             return redirect(route('currencies.index')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ($this->repository->currencyInUse($currency)) { |         if ($this->repository->currencyInUse($currency)) { | ||||||
| @@ -228,16 +224,13 @@ class CurrencyController extends Controller | |||||||
|         /** @var User $user */ |         /** @var User $user */ | ||||||
|         $user = auth()->user(); |         $user = auth()->user(); | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); |             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); | ||||||
|             Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code)); |             Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code)); | ||||||
|             return response()->json([]); |             return response()->json([]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // currency cannot be in use. |         // currency cannot be in use. | ||||||
|         if ($this->repository->currencyInUse($currency)) { |         if ($this->repository->currencyInUse($currency)) { | ||||||
|  |  | ||||||
|             $location = $this->repository->currencyInUseAt($currency); |             $location = $this->repository->currencyInUseAt($currency); | ||||||
|             $message  = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]); |             $message  = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]); | ||||||
|  |  | ||||||
| @@ -274,12 +267,10 @@ class CurrencyController extends Controller | |||||||
|         /** @var User $user */ |         /** @var User $user */ | ||||||
|         $user = auth()->user(); |         $user = auth()->user(); | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); |             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); | ||||||
|             Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code)); |             Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code)); | ||||||
|  |  | ||||||
|             return redirect(route('currencies.index')); |             return redirect(route('currencies.index')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $subTitleIcon     = 'fa-pencil'; |         $subTitleIcon     = 'fa-pencil'; | ||||||
| @@ -371,12 +362,10 @@ class CurrencyController extends Controller | |||||||
|         $user = auth()->user(); |         $user = auth()->user(); | ||||||
|         $data = $request->getCurrencyData(); |         $data = $request->getCurrencyData(); | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.'); |             Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.'); | ||||||
|             Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data); |             Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data); | ||||||
|  |  | ||||||
|             return redirect($this->getPreviousUrl('currencies.create.url')); |             return redirect($this->getPreviousUrl('currencies.create.url')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $data['enabled'] = true; |         $data['enabled'] = true; | ||||||
| @@ -394,11 +383,9 @@ class CurrencyController extends Controller | |||||||
|             $request->session()->flash('success', (string) trans('firefly.created_currency', ['name' => $currency->name])); |             $request->session()->flash('success', (string) trans('firefly.created_currency', ['name' => $currency->name])); | ||||||
|             Log::channel('audit')->info('Created (POST) currency.', $data); |             Log::channel('audit')->info('Created (POST) currency.', $data); | ||||||
|             if (1 === (int) $request->get('create_another')) { |             if (1 === (int) $request->get('create_another')) { | ||||||
|  |  | ||||||
|                 $request->session()->put('currencies.create.fromStore', true); |                 $request->session()->put('currencies.create.fromStore', true); | ||||||
|  |  | ||||||
|                 $redirect = redirect(route('currencies.create'))->withInput(); |                 $redirect = redirect(route('currencies.create'))->withInput(); | ||||||
|  |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -423,12 +410,10 @@ class CurrencyController extends Controller | |||||||
|             $data['enabled'] = true; |             $data['enabled'] = true; | ||||||
|         } |         } | ||||||
|         if (!$this->userRepository->hasRole($user, 'owner')) { |         if (!$this->userRepository->hasRole($user, 'owner')) { | ||||||
|  |  | ||||||
|             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); |             $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); | ||||||
|             Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data); |             Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data); | ||||||
|  |  | ||||||
|             return redirect(route('currencies.index')); |             return redirect(route('currencies.index')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|         $currency = $this->repository->update($currency, $data); |         $currency = $this->repository->update($currency, $data); | ||||||
|         Log::channel('audit')->info('Updated (POST) currency.', $data); |         Log::channel('audit')->info('Updated (POST) currency.', $data); | ||||||
| @@ -436,11 +421,9 @@ class CurrencyController extends Controller | |||||||
|         app('preferences')->mark(); |         app('preferences')->mark(); | ||||||
|  |  | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             $request->session()->put('currencies.edit.fromUpdate', true); |             $request->session()->put('currencies.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             return redirect(route('currencies.edit', [$currency->id])); |             return redirect(route('currencies.edit', [$currency->id])); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return redirect($this->getPreviousUrl('currencies.edit.url')); |         return redirect($this->getPreviousUrl('currencies.edit.url')); | ||||||
|   | |||||||
| @@ -98,7 +98,6 @@ class DebugController extends Controller | |||||||
|         Log::debug('Call twig:clean...'); |         Log::debug('Call twig:clean...'); | ||||||
|         try { |         try { | ||||||
|             Artisan::call('twig:clean'); |             Artisan::call('twig:clean'); | ||||||
|  |  | ||||||
|         } catch (Exception $e) { // @phpstan-ignore-line |         } catch (Exception $e) { // @phpstan-ignore-line | ||||||
|             // @ignoreException |             // @ignoreException | ||||||
|         } |         } | ||||||
| @@ -189,11 +188,9 @@ class DebugController extends Controller | |||||||
|                 if (null !== $logFile) { |                 if (null !== $logFile) { | ||||||
|                     try { |                     try { | ||||||
|                         $logContent = file_get_contents($logFile); |                         $logContent = file_get_contents($logFile); | ||||||
|  |  | ||||||
|                     } catch (Exception $e) { // @phpstan-ignore-line |                     } catch (Exception $e) { // @phpstan-ignore-line | ||||||
|                         // @ignoreException |                         // @ignoreException | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -238,7 +235,6 @@ class DebugController extends Controller | |||||||
|                 'defaultLanguage', |                 'defaultLanguage', | ||||||
|                 'defaultLocale', |                 'defaultLocale', | ||||||
|                 'isDocker' |                 'isDocker' | ||||||
|  |  | ||||||
|             ) |             ) | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -166,5 +166,4 @@ class JavascriptController extends Controller | |||||||
|             ->view('v2.javascript.variables', $data) |             ->view('v2.javascript.variables', $data) | ||||||
|             ->header('Content-Type', 'text/javascript'); |             ->header('Content-Type', 'text/javascript'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -95,7 +95,6 @@ class NewUserController extends Controller | |||||||
|         $language = $request->convertString('language'); |         $language = $request->convertString('language'); | ||||||
|         if (!array_key_exists($language, config('firefly.languages'))) { |         if (!array_key_exists($language, config('firefly.languages'))) { | ||||||
|             $language = 'en_US'; |             $language = 'en_US'; | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // set language preference: |         // set language preference: | ||||||
| @@ -133,5 +132,4 @@ class NewUserController extends Controller | |||||||
|  |  | ||||||
|         return redirect(route('index')); |         return redirect(route('index')); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -195,10 +195,10 @@ class PreferencesController extends Controller | |||||||
|  |  | ||||||
|         // slack URL: |         // slack URL: | ||||||
|         $url = (string) $request->get('slackUrl'); |         $url = (string) $request->get('slackUrl'); | ||||||
|         if(str_starts_with($url, 'https://hooks.slack.com/services/')){ |         if (str_starts_with($url, 'https://hooks.slack.com/services/')) { | ||||||
|             app('preferences')->set('slack_webhook_url', $url); |             app('preferences')->set('slack_webhook_url', $url); | ||||||
|         } |         } | ||||||
|         if('' === $url) { |         if ('' === $url) { | ||||||
|             app('preferences')->delete('slack_webhook_url'); |             app('preferences')->delete('slack_webhook_url'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -210,9 +210,7 @@ class ProfileController extends Controller | |||||||
|     public function confirmEmailChange(UserRepositoryInterface $repository, string $token) |     public function confirmEmailChange(UserRepositoryInterface $repository, string $token) | ||||||
|     { |     { | ||||||
|         if (!$this->internalAuth || !$this->internalIdentity) { |         if (!$this->internalAuth || !$this->internalIdentity) { | ||||||
|  |  | ||||||
|             throw new FireflyException(trans('firefly.external_user_mgt_disabled')); |             throw new FireflyException(trans('firefly.external_user_mgt_disabled')); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|         // find preference with this token value. |         // find preference with this token value. | ||||||
|         /** @var Collection $set */ |         /** @var Collection $set */ | ||||||
| @@ -349,7 +347,8 @@ class ProfileController extends Controller | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         return view( |         return view( | ||||||
|             'profile.index', compact('subTitle', 'mfaBackupCount', 'userId', 'accessToken', 'enabled2FA', 'isInternalAuth', 'isInternalIdentity') |             'profile.index', | ||||||
|  |             compact('subTitle', 'mfaBackupCount', 'userId', 'accessToken', 'enabled2FA', 'isInternalAuth', 'isInternalIdentity') | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -633,7 +632,6 @@ class ProfileController extends Controller | |||||||
|         session()->flash('error', (string) trans('auth.failed')); |         session()->flash('error', (string) trans('auth.failed')); | ||||||
|  |  | ||||||
|         return redirect(route('profile.index')); |         return redirect(route('profile.index')); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -119,7 +119,6 @@ class SearchController extends Controller | |||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             $html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render(); |             $html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render(); | ||||||
|  |  | ||||||
|         } catch (Throwable $e) { // @phpstan-ignore-line |         } catch (Throwable $e) { // @phpstan-ignore-line | ||||||
|             Log::error(sprintf('Cannot render search.search: %s', $e->getMessage())); |             Log::error(sprintf('Cannot render search.search: %s', $e->getMessage())); | ||||||
|             $html = 'Could not render view.'; |             $html = 'Could not render view.'; | ||||||
|   | |||||||
| @@ -335,11 +335,9 @@ class TagController extends Controller | |||||||
|         } |         } | ||||||
|         $redirect = redirect($this->getPreviousUrl('tags.create.url')); |         $redirect = redirect($this->getPreviousUrl('tags.create.url')); | ||||||
|         if (1 === (int) $request->get('create_another')) { |         if (1 === (int) $request->get('create_another')) { | ||||||
|  |  | ||||||
|             session()->put('tags.create.fromStore', true); |             session()->put('tags.create.fromStore', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('tags.create'))->withInput(); |             $redirect = redirect(route('tags.create'))->withInput(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $redirect; |         return $redirect; | ||||||
| @@ -376,11 +374,9 @@ class TagController extends Controller | |||||||
|         } |         } | ||||||
|         $redirect = redirect($this->getPreviousUrl('tags.edit.url')); |         $redirect = redirect($this->getPreviousUrl('tags.edit.url')); | ||||||
|         if (1 === (int) $request->get('return_to_edit')) { |         if (1 === (int) $request->get('return_to_edit')) { | ||||||
|  |  | ||||||
|             session()->put('tags.edit.fromUpdate', true); |             session()->put('tags.edit.fromUpdate', true); | ||||||
|  |  | ||||||
|             $redirect = redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]); |             $redirect = redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // redirect to previous URL. |         // redirect to previous URL. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user