From 115639a004872a0c3059c053c747bf3cd5e6152f Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 8 Apr 2021 10:13:35 +0200 Subject: [PATCH] Clean up some code. --- app/Helpers/Attachments/AttachmentHelper.php | 19 +++++++------------ app/Http/Middleware/InterestingMessage.php | 3 +++ config/firefly.php | 13 ++----------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index e69ab16ffa..eca3f3fa3a 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -42,16 +42,11 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; */ class AttachmentHelper implements AttachmentHelperInterface { - /** @var Collection All attachments */ - public $attachments; - /** @var MessageBag All errors */ - public $errors; - /** @var MessageBag All messages */ - public $messages; - /** @var array Allowed mimes */ - protected $allowedMimes = []; - /** @var int Max upload size. */ - protected $maxUploadSize = 0; + public Collection $attachments; + public MessageBag $errors; + public MessageBag $messages; + protected array $allowedMimes = []; + protected int $maxUploadSize = 0; /** @var Filesystem The disk where attachments are stored. */ protected $uploadDisk; @@ -204,7 +199,7 @@ class AttachmentHelper implements AttachmentHelperInterface public function saveAttachmentsForModel(object $model, ?array $files): bool { if (!($model instanceof Model)) { - return false; + return false; } Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model))); @@ -263,7 +258,7 @@ class AttachmentHelper implements AttachmentHelperInterface $fileObject->rewind(); if (0 === $file->getSize()) { - throw new FireflyException('Cannot upload empty or non-existent file.'); + throw new FireflyException('Cannot upload empty or non-existent file.'); } $content = $fileObject->fread($file->getSize()); diff --git a/app/Http/Middleware/InterestingMessage.php b/app/Http/Middleware/InterestingMessage.php index 2fc7394427..0d199782dc 100644 --- a/app/Http/Middleware/InterestingMessage.php +++ b/app/Http/Middleware/InterestingMessage.php @@ -103,6 +103,9 @@ class InterestingMessage if ('deleted' === $message) { session()->flash('success', (string)trans('firefly.account_deleted', ['name' => $account->name])); } + if('created' === $message) { + session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name])); + } } /** * @param Request $request diff --git a/config/firefly.php b/config/firefly.php index 192361c718..971585fe7a 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -123,14 +123,13 @@ return [ 'login_provider' => envNonEmpty('LOGIN_PROVIDER', 'eloquent'), 'authentication_guard' => envNonEmpty('AUTHENTICATION_GUARD', 'web'), 'custom_logout_uri' => envNonEmpty('CUSTOM_LOGOUT_URI', ''), - 'cer_provider' => envNonEmpty('CER_PROVIDER', 'fixer'), 'ipinfo_token' => env('IPINFO_TOKEN', ''), 'update_endpoint' => 'https://version.firefly-iii.org/index.json', 'send_telemetry' => env('SEND_TELEMETRY', false), 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), 'telemetry_endpoint' => 'https://telemetry.firefly-iii.org', 'layout' => envNonEmpty('FIREFLY_III_LAYOUT', 'v1'), - 'update_minimum_age' => 6, + 'update_minimum_age' => 7, 'default_location' => [ 'longitude' => env('MAP_DEFAULT_LONG', '5.916667'), 'latitude' => env('MAP_DEFAULT_LAT', '51.983333'), @@ -208,7 +207,7 @@ return [ 'application/vnd.oasis.opendocument.database', 'application/vnd.oasis.opendocument.image', ], - 'list_length' => 10, + 'list_length' => 10, // to be removed if v1 is cancelled. 'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], 'interest_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], 'accountRoles' => ['defaultAsset', 'sharedAsset', 'savingAsset', 'ccAsset', 'cashWalletAsset'], @@ -333,14 +332,6 @@ return [ 'zh_TW' => ['name_locale' => 'Chinese Traditional', 'name_english' => 'Chinese Traditional'], 'zh_CN' => ['name_locale' => 'Chinese Simplified', 'name_english' => 'Chinese Simplified'], ], - 'transactionTypesByWhat' => [ - 'expenses' => ['Withdrawal'], - 'withdrawal' => ['Withdrawal'], - 'revenue' => ['Deposit'], - 'deposit' => ['Deposit'], - 'transfer' => ['Transfer'], - 'transfers' => ['Transfer'], - ], 'transactionTypesByType' => [ 'expenses' => ['Withdrawal'], 'withdrawal' => ['Withdrawal'],