Skip to content

Firefly III: a personal finances manager

Code cleanup

James Cole0133a7c5db75
diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock
index b783d43031..f97e8f97ee 100644
--- a/.ci/php-cs-fixer/composer.lock
+++ b/.ci/php-cs-fixer/composer.lock
@@ -226,16 +226,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
- "version": "v3.35.1",
+ "version": "v3.36.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
- "reference": "ec1ccc264994b6764882669973ca435cf05bab08"
+ "reference": "e889301f276c6ce2c391d6aafae9a162e785b064"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ec1ccc264994b6764882669973ca435cf05bab08",
- "reference": "ec1ccc264994b6764882669973ca435cf05bab08",
+ "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e889301f276c6ce2c391d6aafae9a162e785b064",
+ "reference": "e889301f276c6ce2c391d6aafae9a162e785b064",
"shasum": ""
},
"require": {
@@ -307,7 +307,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
- "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.35.1"
+ "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.36.0"
},
"funding": [
{
@@ -315,7 +315,7 @@
"type": "github"
}
],
- "time": "2023-10-12T13:47:26+00:00"
+ "time": "2023-10-27T10:12:29+00:00"
},
{
"name": "psr/container",
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php
index a115094368..951bdfb474 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php
@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Validator;
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
index 0b22a06dac..3e7c74fcb4 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
@@ -87,7 +87,7 @@ class ShowController extends Controller
$currencies = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($currencies, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.index') . $this->buildParams());
- $manager = $this->getManager();
+ $manager = $this->getManager();
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
@@ -144,7 +144,7 @@ class ShowController extends Controller
public function showDefault(): JsonResponse
{
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
$manager = $this->getManager();
$currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
index f37f58e672..f861fe998e 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
@@ -83,7 +83,7 @@ class StoreController extends Controller
$this->repository->makeDefault($currency);
app('preferences')->mark();
}
- $manager = $this->getManager();
+ $manager = $this->getManager();
/** @var User $user */
$user = auth()->user();
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
index aea98eb6d6..9bb531a603 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
@@ -183,11 +183,11 @@ class UpdateController extends Controller
$data = $request->getAll();
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
// safety catch on currency disablement.
$set = $this->repository->get();
- if(array_key_exists('enabled', $data) && false === $data['enabled'] && 1 === count($set) && $set->first()->id === $currency->id){
+ if (array_key_exists('enabled', $data) && false === $data['enabled'] && 1 === count($set) && $set->first()->id === $currency->id) {
return response()->json([], 409);
}
diff --git a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php
index 85969756fe..eb6b1ad5bf 100644
--- a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php
+++ b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php
@@ -71,9 +71,9 @@ class CreateRequest extends FormRequest
*/
public function rules(): array
{
- $triggers = implode(',', array_keys(Webhook::getTriggersForValidation()));
- $responses = implode(',', array_keys(Webhook::getResponsesForValidation()));
- $deliveries = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
+ $triggers = implode(',', array_keys(Webhook::getTriggersForValidation()));
+ $responses = implode(',', array_keys(Webhook::getResponsesForValidation()));
+ $deliveries = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
$validProtocols = config('firefly.valid_url_protocols');
return [
'title' => 'required|between:1,512|uniqueObjectForUser:webhooks,title',
diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php
index 5da7fc8381..a3dd036c4b 100644
--- a/app/Api/V2/Controllers/Autocomplete/AccountController.php
+++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php
@@ -32,7 +32,6 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
-use http\Env\Response;
use Illuminate\Http\JsonResponse;
/**
diff --git a/app/Api/V2/Controllers/Chart/BudgetController.php b/app/Api/V2/Controllers/Chart/BudgetController.php
index 39008f0106..eb3ebb8389 100644
--- a/app/Api/V2/Controllers/Chart/BudgetController.php
+++ b/app/Api/V2/Controllers/Chart/BudgetController.php
@@ -32,13 +32,12 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\TransactionCurrency;
+use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface;
-use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Support\Http\Api\CleansChartData;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
-use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
diff --git a/app/Api/V2/Controllers/Model/Bill/ShowController.php b/app/Api/V2/Controllers/Model/Bill/ShowController.php
index 6c2793fa1c..ab7781065e 100644
--- a/app/Api/V2/Controllers/Model/Bill/ShowController.php
+++ b/app/Api/V2/Controllers/Model/Bill/ShowController.php
@@ -26,11 +26,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\Bill;
use FireflyIII\Api\V2\Controllers\Controller;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
-use FireflyIII\Transformers\V2\AccountTransformer;
use FireflyIII\Transformers\V2\BillTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
diff --git a/app/Api/V2/Controllers/Model/Bill/SumController.php b/app/Api/V2/Controllers/Model/Bill/SumController.php
index 782cd940c6..161dfdd4ce 100644
--- a/app/Api/V2/Controllers/Model/Bill/SumController.php
+++ b/app/Api/V2/Controllers/Model/Bill/SumController.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;
diff --git a/app/Api/V2/Controllers/Model/Budget/ShowController.php b/app/Api/V2/Controllers/Model/Budget/ShowController.php
index 70a0490b45..c238848359 100644
--- a/app/Api/V2/Controllers/Model/Budget/ShowController.php
+++ b/app/Api/V2/Controllers/Model/Budget/ShowController.php
@@ -27,7 +27,6 @@ namespace FireflyIII\Api\V2\Controllers\Model\Budget;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
diff --git a/app/Api/V2/Controllers/Model/Budget/SumController.php b/app/Api/V2/Controllers/Model/Budget/SumController.php
index 394ee1bc00..15de6ca665 100644
--- a/app/Api/V2/Controllers/Model/Budget/SumController.php
+++ b/app/Api/V2/Controllers/Model/Budget/SumController.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V2\Controllers\Model\Budget;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
use Illuminate\Http\JsonResponse;
diff --git a/app/Api/V2/Controllers/Model/PiggyBank/ShowController.php b/app/Api/V2/Controllers/Model/PiggyBank/ShowController.php
index e75e8b8866..e3a74c16bf 100644
--- a/app/Api/V2/Controllers/Model/PiggyBank/ShowController.php
+++ b/app/Api/V2/Controllers/Model/PiggyBank/ShowController.php
@@ -26,7 +26,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\PiggyBank;
use FireflyIII\Api\V2\Controllers\Controller;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\PiggyBankTransformer;
diff --git a/app/Api/V2/Controllers/Model/Transaction/StoreController.php b/app/Api/V2/Controllers/Model/Transaction/StoreController.php
index dc14f8b22e..4dc062cb0e 100644
--- a/app/Api/V2/Controllers/Model/Transaction/StoreController.php
+++ b/app/Api/V2/Controllers/Model/Transaction/StoreController.php
@@ -30,7 +30,6 @@ use FireflyIII\Api\V2\Request\Model\Transaction\StoreRequest;
use FireflyIII\Events\StoredTransactionGroup;
use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException;
-use Illuminate\Validation\ValidationException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Rules\IsDuplicateTransaction;
@@ -38,6 +37,7 @@ use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Validator;
+use Illuminate\Validation\ValidationException;
/**
* Class StoreController
diff --git a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php
index 9da06a81be..e406a9e8b3 100644
--- a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php
+++ b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php
@@ -28,9 +28,7 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User;
-use FireflyIII\Validation\Administration\ValidatesAdministrationAccess;
use Illuminate\Foundation\Http\FormRequest;
-use Illuminate\Validation\Validator;
/**
* Class AutocompleteRequest
diff --git a/app/Api/V2/Request/Model/Transaction/StoreRequest.php b/app/Api/V2/Request/Model/Transaction/StoreRequest.php
index 4404f6f72e..44ba9fffcc 100644
--- a/app/Api/V2/Request/Model/Transaction/StoreRequest.php
+++ b/app/Api/V2/Request/Model/Transaction/StoreRequest.php
@@ -57,6 +57,7 @@ class StoreRequest extends FormRequest
use GroupValidation;
use CurrencyValidation;
use AppendsLocationData;
+
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
/**
diff --git a/app/Api/V2/Request/UserGroup/StoreRequest.php b/app/Api/V2/Request/UserGroup/StoreRequest.php
index 21e5a76719..d90f71cf3c 100644
--- a/app/Api/V2/Request/UserGroup/StoreRequest.php
+++ b/app/Api/V2/Request/UserGroup/StoreRequest.php
@@ -37,6 +37,7 @@ class StoreRequest extends FormRequest
{
use ChecksLogin;
use ConvertsDataTypes;
+
protected array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL];
/**
diff --git a/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php b/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php
index 3a671268d8..75b56e49ad 100644
--- a/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php
+++ b/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php
@@ -37,6 +37,7 @@ class UpdateMembershipRequest extends FormRequest
{
use ChecksLogin;
use ConvertsDataTypes;
+
protected array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL];
/**
diff --git a/app/Api/V2/Request/UserGroup/UpdateRequest.php b/app/Api/V2/Request/UserGroup/UpdateRequest.php
index d3b0481fcc..3ab965f776 100644
--- a/app/Api/V2/Request/UserGroup/UpdateRequest.php
+++ b/app/Api/V2/Request/UserGroup/UpdateRequest.php
@@ -38,6 +38,7 @@ class UpdateRequest extends FormRequest
{
use ChecksLogin;
use ConvertsDataTypes;
+
protected array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL];
/**
diff --git a/app/Console/Commands/Correction/CorrectDatabase.php b/app/Console/Commands/Correction/CorrectDatabase.php
index e7db8d30c5..73620febd8 100644
--- a/app/Console/Commands/Correction/CorrectDatabase.php
+++ b/app/Console/Commands/Correction/CorrectDatabase.php
@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction;
-use Artisan;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
use Schema;
diff --git a/app/Console/Commands/Integrity/ReportIntegrity.php b/app/Console/Commands/Integrity/ReportIntegrity.php
index 5075e69ea9..c90224fd22 100644
--- a/app/Console/Commands/Integrity/ReportIntegrity.php
+++ b/app/Console/Commands/Integrity/ReportIntegrity.php
@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Integrity;
-use Artisan;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
use Schema;
diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php
index da588a219d..0a05dbf1d5 100644
--- a/app/Console/Commands/Upgrade/AccountCurrencies.php
+++ b/app/Console/Commands/Upgrade/AccountCurrencies.php
@@ -34,7 +34,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
index 5a34f8f091..845dd0eda8 100644
--- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
@@ -45,8 +45,8 @@ class OtherCurrenciesCorrections extends Command
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_other_currencies';
- protected $description = 'Update all journal currency information.';
- protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
+ protected $description = 'Update all journal currency information.';
+ protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;
diff --git a/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
index 2da07ec117..b6ee8c2a1c 100644
--- a/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
+++ b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
@@ -68,30 +68,6 @@ class UpgradeCurrencyPreferences extends Command
return false;
}
- /**
- * @param User $user
- *
- * @return string
- */
- private function getPreference(User $user): string
- {
- $preference = Preference::where('user_id', $user->id)->where('name', 'currencyPreference')->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
-
- if (null !== $preference) {
- return (string)$preference->data;
- }
- return 'EUR';
- }
-
-
- /**
- *
- */
- private function markAsExecuted(): void
- {
- app('fireflyconfig')->set(self::CONFIG_NAME, true);
- }
-
private function runUpgrade(): void
{
$groups = UserGroup::get();
@@ -107,6 +83,24 @@ class UpgradeCurrencyPreferences extends Command
}
}
+ /**
+ * @param UserGroup $group
+ *
+ * @return void
+ */
+ private function upgradeGroupPreferences(UserGroup $group)
+ {
+ $currencies = TransactionCurrency::get();
+ $enabled = new Collection();
+ /** @var TransactionCurrency $currency */
+ foreach ($currencies as $currency) {
+ if ($currency->enabled) {
+ $enabled->push($currency);
+ }
+ }
+ $group->currencies()->sync($enabled->pluck('id')->toArray());
+ }
+
/**
* @param User $user
*
@@ -136,20 +130,25 @@ class UpgradeCurrencyPreferences extends Command
}
/**
- * @param UserGroup $group
+ * @param User $user
*
- * @return void
+ * @return string
*/
- private function upgradeGroupPreferences(UserGroup $group)
+ private function getPreference(User $user): string
{
- $currencies = TransactionCurrency::get();
- $enabled = new Collection();
- /** @var TransactionCurrency $currency */
- foreach ($currencies as $currency) {
- if ($currency->enabled) {
- $enabled->push($currency);
- }
+ $preference = Preference::where('user_id', $user->id)->where('name', 'currencyPreference')->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
+
+ if (null !== $preference) {
+ return (string)$preference->data;
}
- $group->currencies()->sync($enabled->pluck('id')->toArray());
+ return 'EUR';
+ }
+
+ /**
+ *
+ */
+ private function markAsExecuted(): void
+ {
+ app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}
diff --git a/app/Console/Commands/Upgrade/UpgradeDatabase.php b/app/Console/Commands/Upgrade/UpgradeDatabase.php
index 544881ea18..3f48f1f1b8 100644
--- a/app/Console/Commands/Upgrade/UpgradeDatabase.php
+++ b/app/Console/Commands/Upgrade/UpgradeDatabase.php
@@ -25,7 +25,6 @@ namespace FireflyIII\Console\Commands\Upgrade;
set_time_limit(0);
-use Artisan;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
@@ -72,7 +71,7 @@ class UpgradeDatabase extends Command
// also just in case, some integrity commands:
'firefly-iii:create-group-memberships',
'firefly-iii:upgrade-group-information',
- 'firefly-iii:upgrade-currency-preferences'
+ 'firefly-iii:upgrade-currency-preferences',
];
$args = [];
if ($this->option('force')) {
diff --git a/app/Factory/AccountMetaFactory.php b/app/Factory/AccountMetaFactory.php
index e92b88a6cc..46f1d013b1 100644
--- a/app/Factory/AccountMetaFactory.php
+++ b/app/Factory/AccountMetaFactory.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
-use Illuminate\Support\Facades\Log;
/**
* Class AccountMetaFactory
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 24b08614f6..2c0c5756ac 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -39,9 +39,9 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\TransactionType\TransactionTypeRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
use FireflyIII\Support\NullArrayObject;
diff --git a/app/Helpers/Collector/Extensions/CollectorProperties.php b/app/Helpers/Collector/Extensions/CollectorProperties.php
index bfdb78349b..fcb67c5d5b 100644
--- a/app/Helpers/Collector/Extensions/CollectorProperties.php
+++ b/app/Helpers/Collector/Extensions/CollectorProperties.php
@@ -34,29 +34,29 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
trait CollectorProperties
{
public const TEST = 'Test';
- private bool $expandGroupSearch;
- private array $fields;
- private bool $hasAccountInfo;
- private bool $hasBillInformation;
- private bool $hasBudgetInformation;
- private bool $hasCatInformation;
- private bool $hasJoinedAttTables;
- private bool $hasJoinedMetaTables;
- private bool $hasJoinedTagTables;
- private bool $hasNotesInformation;
- private array $integerFields;
- private ?int $limit;
- private ?int $page;
- private array $postFilters;
+ private bool $expandGroupSearch;
+ private array $fields;
+ private bool $hasAccountInfo;
+ private bool $hasBillInformation;
+ private bool $hasBudgetInformation;
+ private bool $hasCatInformation;
+ private bool $hasJoinedAttTables;
+ private bool $hasJoinedMetaTables;
+ private bool $hasJoinedTagTables;
+ private bool $hasNotesInformation;
+ private array $integerFields;
+ private ?int $limit;
+ private ?int $page;
+ private array $postFilters;
private HasMany $query;
- private array $stringFields;
+ private array $stringFields;
/*
* This array is used to collect ALL tags the user may search for (using 'setTags').
* This way the user can call 'setTags' multiple times and get a joined result.
*
*/
- private array $tags;
- private int $total;
- private ?User $user;
+ private array $tags;
+ private int $total;
+ private ?User $user;
private ?UserGroup $userGroup;
}
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index 99a15e67c1..de4a6d0d90 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -29,8 +29,8 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\User;
diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php
index 287cbca014..980b7b1050 100644
--- a/app/Helpers/Report/PopupReport.php
+++ b/app/Helpers/Report/PopupReport.php
@@ -29,8 +29,8 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
/**
diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php
index 164454e996..6c1808a257 100644
--- a/app/Http/Controllers/Transaction/CreateController.php
+++ b/app/Http/Controllers/Transaction/CreateController.php
@@ -89,7 +89,7 @@ class CreateController extends Controller
session()->flash('success', trans('firefly.stored_journal', ['description' => $title]));
session()->flash('success_url', $link);
- if('edit' === $request->get('redirect')) {
+ if ('edit' === $request->get('redirect')) {
return response()->json(['redirect' => route('transactions.edit', [$newGroup->id])]);
}
diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php
index 5949af4a02..50b7b00e9f 100644
--- a/app/Http/Controllers/Transaction/EditController.php
+++ b/app/Http/Controllers/Transaction/EditController.php
@@ -63,17 +63,6 @@ class EditController extends Controller
);
}
- /**
- * @param TransactionJournal $journal
- *
- * @return JsonResponse
- */
- public function unreconcile(TransactionJournal $journal): JsonResponse
- {
- $this->repository->unreconcileById($journal->id);
- return response()->json([], 204);
- }
-
/**
* @param TransactionGroup $transactionGroup
*
@@ -116,4 +105,15 @@ class EditController extends Controller
)
);
}
+
+ /**
+ * @param TransactionJournal $journal
+ *
+ * @return JsonResponse
+ */
+ public function unreconcile(TransactionJournal $journal): JsonResponse
+ {
+ $this->repository->unreconcileById($journal->id);
+ return response()->json([], 204);
+ }
}
diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php
index 92a26333cf..8742e45765 100644
--- a/app/Http/Controllers/TransactionCurrency/CreateController.php
+++ b/app/Http/Controllers/TransactionCurrency/CreateController.php
@@ -7,8 +7,8 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\CurrencyFormRequest;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
@@ -45,6 +45,7 @@ class CreateController extends Controller
}
);
}
+
/**
* Create a currency.
*
diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php
index 76f95452e4..00d36900dd 100644
--- a/app/Http/Controllers/TransactionCurrency/DeleteController.php
+++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php
@@ -6,8 +6,8 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
@@ -46,7 +46,6 @@ class DeleteController extends Controller
}
-
/**
* Deletes a currency.
*
diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php
index 037163caa4..8a38de1fd2 100644
--- a/app/Http/Controllers/TransactionCurrency/EditController.php
+++ b/app/Http/Controllers/TransactionCurrency/EditController.php
@@ -7,8 +7,8 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\TransactionCurrency;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
@@ -68,7 +68,7 @@ class EditController extends Controller
// is currently enabled (for this user?)
$userCurrencies = $this->repository->get()->pluck('id')->toArray();
- $enabled = in_array($currency->id, $userCurrencies, true);
+ $enabled = in_array($currency->id, $userCurrencies, true);
// code to handle active-checkboxes
$hasOldInput = null !== $request->old('_token');
diff --git a/app/Http/Controllers/TransactionCurrency/IndexController.php b/app/Http/Controllers/TransactionCurrency/IndexController.php
index ab750dac49..35b943e445 100644
--- a/app/Http/Controllers/TransactionCurrency/IndexController.php
+++ b/app/Http/Controllers/TransactionCurrency/IndexController.php
@@ -6,8 +6,8 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
diff --git a/app/Http/Middleware/InterestingMessage.php b/app/Http/Middleware/InterestingMessage.php
index a9c8c42044..dca641ef2e 100644
--- a/app/Http/Middleware/InterestingMessage.php
+++ b/app/Http/Middleware/InterestingMessage.php
@@ -232,6 +232,32 @@ class InterestingMessage
return null !== $webhookId && null !== $message;
}
+ /**
+ * @param Request $request
+ */
+ private function handleWebhookMessage(Request $request): void
+ {
+ // get parameters from request.
+ $webhookId = $request->get('webhook_id');
+ $message = $request->get('message');
+
+ /** @var Webhook $webhook */
+ $webhook = auth()->user()->webhooks()->withTrashed()->find($webhookId);
+
+ if (null === $webhook) {
+ return;
+ }
+ if ('deleted' === $message) {
+ session()->flash('success', (string)trans('firefly.deleted_webhook', ['title' => $webhook->title]));
+ }
+ if ('updated' === $message) {
+ session()->flash('success', (string)trans('firefly.updated_webhook', ['title' => $webhook->title]));
+ }
+ if ('created' === $message) {
+ session()->flash('success', (string)trans('firefly.stored_new_webhook', ['title' => $webhook->title]));
+ }
+ }
+
/**
* @param Request $request
*
@@ -278,30 +304,4 @@ class InterestingMessage
session()->flash('error', (string)trans('firefly.default_currency_failed', ['name' => $currency->name]));
}
}
-
- /**
- * @param Request $request
- */
- private function handleWebhookMessage(Request $request): void
- {
- // get parameters from request.
- $webhookId = $request->get('webhook_id');
- $message = $request->get('message');
-
- /** @var Webhook $webhook */
- $webhook = auth()->user()->webhooks()->withTrashed()->find($webhookId);
-
- if (null === $webhook) {
- return;
- }
- if ('deleted' === $message) {
- session()->flash('success', (string)trans('firefly.deleted_webhook', ['title' => $webhook->title]));
- }
- if ('updated' === $message) {
- session()->flash('success', (string)trans('firefly.updated_webhook', ['title' => $webhook->title]));
- }
- if ('created' === $message) {
- session()->flash('success', (string)trans('firefly.stored_new_webhook', ['title' => $webhook->title]));
- }
- }
}
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index e201825218..9301910560 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -40,6 +40,7 @@ class AccountFormRequest extends FormRequest
use ConvertsDataTypes;
use AppendsLocationData;
use ChecksLogin;
+
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
/**
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 11fc5c1aa4..502516f467 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -42,36 +42,36 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class Account
*
- * @property int $id
- * @property \Illuminate\Support\Carbon|null $created_at
- * @property \Illuminate\Support\Carbon|null $updated_at
- * @property \Illuminate\Support\Carbon|null $deleted_at
- * @property int $user_id
- * @property int $account_type_id
- * @property string $name
- * @property string|null $virtual_balance
- * @property string|null $iban
- * @property bool $active
- * @property bool $encrypted
- * @property int $order
- * @property-read Collection|AccountMeta[] $accountMeta
- * @property-read int|null $account_meta_count
- * @property AccountType $accountType
- * @property-read Collection|Attachment[] $attachments
- * @property-read int|null $attachments_count
- * @property-read string $account_number
- * @property-read string $edit_name
- * @property-read Collection|Location[] $locations
- * @property-read int|null $locations_count
- * @property-read Collection|Note[] $notes
- * @property-read int|null $notes_count
- * @property-read Collection|ObjectGroup[] $objectGroups
- * @property-read int|null $object_groups_count
- * @property-read Collection|PiggyBank[] $piggyBanks
- * @property-read int|null $piggy_banks_count
- * @property-read Collection|Transaction[] $transactions
- * @property-read int|null $transactions_count
- * @property-read User $user
+ * @property int $id
+ * @property \Illuminate\Support\Carbon|null $created_at
+ * @property \Illuminate\Support\Carbon|null $updated_at
+ * @property \Illuminate\Support\Carbon|null $deleted_at
+ * @property int $user_id
+ * @property int $account_type_id
+ * @property string $name
+ * @property string|null $virtual_balance
+ * @property string|null $iban
+ * @property bool $active
+ * @property bool $encrypted
+ * @property int $order
+ * @property-read Collection|AccountMeta[] $accountMeta
+ * @property-read int|null $account_meta_count
+ * @property AccountType $accountType
+ * @property-read Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read string $account_number
+ * @property-read string $edit_name
+ * @property-read Collection|Location[] $locations
+ * @property-read int|null $locations_count
+ * @property-read Collection|Note[] $notes
+ * @property-read int|null $notes_count
+ * @property-read Collection|ObjectGroup[] $objectGroups
+ * @property-read int|null $object_groups_count
+ * @property-read Collection|PiggyBank[] $piggyBanks
+ * @property-read int|null $piggy_banks_count
+ * @property-read Collection|Transaction[] $transactions
+ * @property-read int|null $transactions_count
+ * @property-read User $user
* @method static EloquentBuilder|Account accountTypeIn($types)
* @method static EloquentBuilder|Account newModelQuery()
* @method static EloquentBuilder|Account newQuery()
@@ -91,19 +91,19 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static EloquentBuilder|Account whereVirtualBalance($value)
* @method static Builder|Account withTrashed()
* @method static Builder|Account withoutTrashed()
- * @property Carbon $lastActivityDate
- * @property string $startBalance
- * @property string $endBalance
- * @property string $difference
- * @property string $interest
- * @property string $interestPeriod
- * @property string $accountTypeString
- * @property Location $location
- * @property string $liability_direction
- * @property string $current_debt
- * @property int|null $user_group_id
+ * @property Carbon $lastActivityDate
+ * @property string $startBalance
+ * @property string $endBalance
+ * @property string $difference
+ * @property string $interest
+ * @property string $interestPeriod
+ * @property string $accountTypeString
+ * @property Location $location
+ * @property string $liability_direction
+ * @property string $current_debt
+ * @property int|null $user_group_id
* @method static EloquentBuilder|Account whereUserGroupId($value)
- * @property-read \FireflyIII\Models\UserGroup|null $userGroup
+ * @property-read UserGroup|null $userGroup
* @mixin Eloquent
*/
class Account extends Model
diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php
index af3b8e813b..5524921312 100644
--- a/app/Models/ObjectGroup.php
+++ b/app/Models/ObjectGroup.php
@@ -61,7 +61,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|ObjectGroup whereTitle($value)
* @method static Builder|ObjectGroup whereUpdatedAt($value)
* @method static Builder|ObjectGroup whereUserId($value)
- * @property int|null $user_group_id
+ * @property int|null $user_group_id
* @method static Builder|ObjectGroup whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 7c499ad0d9..18e2e6d1dd 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -125,6 +125,14 @@ class Rule extends Model
throw new NotFoundHttpException();
}
+ /**
+ * @return BelongsTo
+ */
+ public function user(): BelongsTo
+ {
+ return $this->belongsTo(User::class);
+ }
+
/**
* @return HasMany
*/
@@ -159,14 +167,6 @@ class Rule extends Model
$this->attributes['description'] = e($value);
}
- /**
- * @return BelongsTo
- */
- public function user(): BelongsTo
- {
- return $this->belongsTo(User::class);
- }
-
/**
* @return BelongsTo
*/
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index 868b38f008..81bf291294 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -37,23 +37,23 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\TransactionCurrency
*
- * @property int $id
- * @property Carbon|null $created_at
- * @property Carbon|null $updated_at
- * @property Carbon|null $deleted_at
- * @property bool $enabled
- * @property bool $userDefault
- * @property bool $userEnabled
- * @property string $code
- * @property string $name
- * @property string $symbol
- * @property int $decimal_places
- * @property-read Collection|BudgetLimit[] $budgetLimits
- * @property-read int|null $budget_limits_count
- * @property-read Collection|TransactionJournal[] $transactionJournals
- * @property-read int|null $transaction_journals_count
- * @property-read Collection|Transaction[] $transactions
- * @property-read int|null $transactions_count
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at
+ * @property bool $enabled
+ * @property bool $userDefault
+ * @property bool $userEnabled
+ * @property string $code
+ * @property string $name
+ * @property string $symbol
+ * @property int $decimal_places
+ * @property-read Collection|BudgetLimit[] $budgetLimits
+ * @property-read int|null $budget_limits_count
+ * @property-read Collection|TransactionJournal[] $transactionJournals
+ * @property-read int|null $transaction_journals_count
+ * @property-read Collection|Transaction[] $transactions
+ * @property-read int|null $transactions_count
* @method static \Illuminate\Database\Eloquent\Builder|TransactionCurrency newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|TransactionCurrency newQuery()
* @method static Builder|TransactionCurrency onlyTrashed()
@@ -69,10 +69,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|TransactionCurrency whereUpdatedAt($value)
* @method static Builder|TransactionCurrency withTrashed()
* @method static Builder|TransactionCurrency withoutTrashed()
- * @property-read Collection<int, \FireflyIII\Models\UserGroup> $userGroups
- * @property-read int|null $user_groups_count
- * @property-read Collection<int, User> $users
- * @property-read int|null $users_count
+ * @property-read Collection<int, UserGroup> $userGroups
+ * @property-read int|null $user_groups_count
+ * @property-read Collection<int, User> $users
+ * @property-read int|null $users_count
* @mixin Eloquent
*/
class TransactionCurrency extends Model
@@ -116,59 +116,59 @@ class TransactionCurrency extends Model
}
/**
- * @param User $user
- *
- * @return void
+ * @return HasMany
*/
- public function refreshForUser(User $user)
+ public function budgetLimits(): HasMany
{
- $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first();
- $default = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
- $this->userDefault = (int)$default->id === (int)$this->id;
- $this->userEnabled = null !== $current;
+ return $this->hasMany(BudgetLimit::class);
}
/**
- * Link to users
+ * @param User $user
*
- * @return BelongsToMany
+ * @return void
*/
- public function users(): BelongsToMany
+ public function refreshForUser(User $user)
{
- return $this->belongsToMany(User::class)->withTimestamps()->withPivot('user_default');
+ $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first();
+ $default = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
+ $this->userDefault = (int)$default->id === (int)$this->id;
+ $this->userEnabled = null !== $current;
}
/**
- * Link to user groups
- *
- * @return BelongsToMany
+ * @return HasMany
*/
- public function userGroups(): BelongsToMany
+ public function transactionJournals(): HasMany
{
- return $this->belongsToMany(UserGroup::class)->withTimestamps()->withPivot('group_default');
+ return $this->hasMany(TransactionJournal::class);
}
/**
* @return HasMany
*/
- public function budgetLimits(): HasMany
+ public function transactions(): HasMany
{
- return $this->hasMany(BudgetLimit::class);
+ return $this->hasMany(Transaction::class);
}
/**
- * @return HasMany
+ * Link to user groups
+ *
+ * @return BelongsToMany
*/
- public function transactionJournals(): HasMany
+ public function userGroups(): BelongsToMany
{
- return $this->hasMany(TransactionJournal::class);
+ return $this->belongsToMany(UserGroup::class)->withTimestamps()->withPivot('group_default');
}
/**
- * @return HasMany
+ * Link to users
+ *
+ * @return BelongsToMany
*/
- public function transactions(): HasMany
+ public function users(): BelongsToMany
{
- return $this->hasMany(Transaction::class);
+ return $this->belongsToMany(User::class)->withTimestamps()->withPivot('user_default');
}
}
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 166cb72b53..39a5bf5e5b 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -41,50 +41,50 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\TransactionJournal
*
- * @property int $id
- * @property Carbon|null $created_at
- * @property Carbon|null $updated_at
- * @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $transaction_type_id
- * @property int|null $transaction_group_id
- * @property int|null $bill_id
- * @property int|null $transaction_currency_id
- * @property string $description
- * @property Carbon $date
- * @property Carbon|null $interest_date
- * @property Carbon|null $book_date
- * @property Carbon|null $process_date
- * @property int $order
- * @property int $tag_count
- * @property string $transaction_type_type
- * @property bool $encrypted
- * @property bool $completed
- * @property-read Collection|Attachment[] $attachments
- * @property-read int|null $attachments_count
- * @property-read Bill|null $bill
- * @property-read Collection|Budget[] $budgets
- * @property-read int|null $budgets_count
- * @property-read Collection|Category[] $categories
- * @property-read int|null $categories_count
- * @property-read Collection|TransactionJournalLink[] $destJournalLinks
- * @property-read int|null $dest_journal_links_count
- * @property-read Collection|Note[] $notes
- * @property-read int|null $notes_count
- * @property-read Collection|PiggyBankEvent[] $piggyBankEvents
- * @property-read int|null $piggy_bank_events_count
- * @property-read Collection|TransactionJournalLink[] $sourceJournalLinks
- * @property-read int|null $source_journal_links_count
- * @property-read Collection|Tag[] $tags
- * @property-read int|null $tags_count
- * @property-read TransactionCurrency|null $transactionCurrency
- * @property-read TransactionGroup|null $transactionGroup
- * @property-read Collection|TransactionJournalMeta[] $transactionJournalMeta
- * @property-read int|null $transaction_journal_meta_count
- * @property-read TransactionType $transactionType
- * @property-read Collection|Transaction[] $transactions
- * @property-read int|null $transactions_count
- * @property-read User $user
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at
+ * @property int $user_id
+ * @property int $transaction_type_id
+ * @property int|null $transaction_group_id
+ * @property int|null $bill_id
+ * @property int|null $transaction_currency_id
+ * @property string $description
+ * @property Carbon $date
+ * @property Carbon|null $interest_date
+ * @property Carbon|null $book_date
+ * @property Carbon|null $process_date
+ * @property int $order
+ * @property int $tag_count
+ * @property string $transaction_type_type
+ * @property bool $encrypted
+ * @property bool $completed
+ * @property-read Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read Bill|null $bill
+ * @property-read Collection|Budget[] $budgets
+ * @property-read int|null $budgets_count
+ * @property-read Collection|Category[] $categories
+ * @property-read int|null $categories_count
+ * @property-read Collection|TransactionJournalLink[] $destJournalLinks
+ * @property-read int|null $dest_journal_links_count
+ * @property-read Collection|Note[] $notes
+ * @property-read int|null $notes_count
+ * @property-read Collection|PiggyBankEvent[] $piggyBankEvents
+ * @property-read int|null $piggy_bank_events_count
+ * @property-read Collection|TransactionJournalLink[] $sourceJournalLinks
+ * @property-read int|null $source_journal_links_count
+ * @property-read Collection|Tag[] $tags
+ * @property-read int|null $tags_count
+ * @property-read TransactionCurrency|null $transactionCurrency
+ * @property-read TransactionGroup|null $transactionGroup
+ * @property-read Collection|TransactionJournalMeta[] $transactionJournalMeta
+ * @property-read int|null $transaction_journal_meta_count
+ * @property-read TransactionType $transactionType
+ * @property-read Collection|Transaction[] $transactions
+ * @property-read int|null $transactions_count
+ * @property-read User $user
* @method static EloquentBuilder|TransactionJournal after(Carbon $date)
* @method static EloquentBuilder|TransactionJournal before(Carbon $date)
* @method static EloquentBuilder|TransactionJournal newModelQuery()
@@ -112,13 +112,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static EloquentBuilder|TransactionJournal whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withTrashed()
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()
- * @property-read Collection|Location[] $locations
- * @property-read int|null $locations_count
- * @property int $the_count
- * @property int|null $user_group_id
+ * @property-read Collection|Location[] $locations
+ * @property-read int|null $locations_count
+ * @property int $the_count
+ * @property int|null $user_group_id
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
- * @property-read Collection<int, \FireflyIII\Models\AuditLogEntry> $auditLogEntries
- * @property-read int|null $audit_log_entries_count
+ * @property-read Collection<int, AuditLogEntry> $auditLogEntries
+ * @property-read int|null $audit_log_entries_count
* @mixin Eloquent
*/
class TransactionJournal extends Model
diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php
index 8d8a2dcbb0..134e2a82da 100644
--- a/app/Models/UserGroup.php
+++ b/app/Models/UserGroup.php
@@ -39,13 +39,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class UserGroup
*
- * @property int $id
- * @property Carbon|null $created_at
- * @property Carbon|null $updated_at
- * @property string|null $deleted_at
- * @property string $title
- * @property-read Collection|GroupMembership[] $groupMemberships
- * @property-read int|null $group_memberships_count
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property string|null $deleted_at
+ * @property string $title
+ * @property-read Collection|GroupMembership[] $groupMemberships
+ * @property-read int|null $group_memberships_count
* @method static Builder|UserGroup newModelQuery()
* @method static Builder|UserGroup newQuery()
* @method static Builder|UserGroup query()
@@ -54,40 +54,40 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|UserGroup whereId($value)
* @method static Builder|UserGroup whereTitle($value)
* @method static Builder|UserGroup whereUpdatedAt($value)
- * @property-read Collection<int, Account> $accounts
- * @property-read int|null $accounts_count
- * @property-read Collection<int, AvailableBudget> $availableBudgets
- * @property-read int|null $available_budgets_count
- * @property-read Collection<int, Bill> $bills
- * @property-read int|null $bills_count
- * @property-read Collection<int, Budget> $budgets
- * @property-read int|null $budgets_count
- * @property-read Collection<int, PiggyBank> $piggyBanks
- * @property-read int|null $piggy_banks_count
- * @property-read Collection<int, TransactionJournal> $transactionJournals
- * @property-read int|null $transaction_journals_count
- * @property-read Collection<int, \FireflyIII\Models\Attachment> $attachments
- * @property-read int|null $attachments_count
- * @property-read Collection<int, \FireflyIII\Models\Category> $categories
- * @property-read int|null $categories_count
- * @property-read Collection<int, \FireflyIII\Models\CurrencyExchangeRate> $currencyExchangeRates
- * @property-read int|null $currency_exchange_rates_count
- * @property-read Collection<int, \FireflyIII\Models\ObjectGroup> $objectGroups
- * @property-read int|null $object_groups_count
- * @property-read Collection<int, \FireflyIII\Models\Recurrence> $recurrences
- * @property-read int|null $recurrences_count
- * @property-read Collection<int, \FireflyIII\Models\RuleGroup> $ruleGroups
- * @property-read int|null $rule_groups_count
- * @property-read Collection<int, \FireflyIII\Models\Rule> $rules
- * @property-read int|null $rules_count
- * @property-read Collection<int, \FireflyIII\Models\Tag> $tags
- * @property-read int|null $tags_count
- * @property-read Collection<int, \FireflyIII\Models\TransactionGroup> $transactionGroups
- * @property-read int|null $transaction_groups_count
- * @property-read Collection<int, \FireflyIII\Models\Webhook> $webhooks
- * @property-read int|null $webhooks_count
- * @property-read Collection<int, \FireflyIII\Models\TransactionCurrency> $currencies
- * @property-read int|null $currencies_count
+ * @property-read Collection<int, Account> $accounts
+ * @property-read int|null $accounts_count
+ * @property-read Collection<int, AvailableBudget> $availableBudgets
+ * @property-read int|null $available_budgets_count
+ * @property-read Collection<int, Bill> $bills
+ * @property-read int|null $bills_count
+ * @property-read Collection<int, Budget> $budgets
+ * @property-read int|null $budgets_count
+ * @property-read Collection<int, PiggyBank> $piggyBanks
+ * @property-read int|null $piggy_banks_count
+ * @property-read Collection<int, TransactionJournal> $transactionJournals
+ * @property-read int|null $transaction_journals_count
+ * @property-read Collection<int, Attachment> $attachments
+ * @property-read int|null $attachments_count
+ * @property-read Collection<int, Category> $categories
+ * @property-read int|null $categories_count
+ * @property-read Collection<int, CurrencyExchangeRate> $currencyExchangeRates
+ * @property-read int|null $currency_exchange_rates_count
+ * @property-read Collection<int, ObjectGroup> $objectGroups
+ * @property-read int|null $object_groups_count
+ * @property-read Collection<int, Recurrence> $recurrences
+ * @property-read int|null $recurrences_count
+ * @property-read Collection<int, RuleGroup> $ruleGroups
+ * @property-read int|null $rule_groups_count
+ * @property-read Collection<int, Rule> $rules
+ * @property-read int|null $rules_count
+ * @property-read Collection<int, Tag> $tags
+ * @property-read int|null $tags_count
+ * @property-read Collection<int, TransactionGroup> $transactionGroups
+ * @property-read int|null $transaction_groups_count
+ * @property-read Collection<int, Webhook> $webhooks
+ * @property-read int|null $webhooks_count
+ * @property-read Collection<int, TransactionCurrency> $currencies
+ * @property-read int|null $currencies_count
* @mixin Eloquent
*/
class UserGroup extends Model
@@ -132,16 +132,6 @@ class UserGroup extends Model
return $this->hasMany(Account::class);
}
- /**
- * Link to currencies
- *
- * @return BelongsToMany
- */
- public function currencies(): BelongsToMany
- {
- return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('group_default');
- }
-
/**
* Link to attachments.
*
@@ -192,6 +182,16 @@ class UserGroup extends Model
return $this->hasMany(Category::class);
}
+ /**
+ * Link to currencies
+ *
+ * @return BelongsToMany
+ */
+ public function currencies(): BelongsToMany
+ {
+ return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('group_default');
+ }
+
/**
* Link to exchange rates.
*
diff --git a/app/Notifications/Admin/TestNotification.php b/app/Notifications/Admin/TestNotification.php
index b79a21f36d..5af18e03c9 100644
--- a/app/Notifications/Admin/TestNotification.php
+++ b/app/Notifications/Admin/TestNotification.php
@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Admin;
use FireflyIII\Support\Notifications\UrlValidator;
-use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
diff --git a/app/Notifications/Admin/UserInvitation.php b/app/Notifications/Admin/UserInvitation.php
index 60d05bab97..45384ca8d8 100644
--- a/app/Notifications/Admin/UserInvitation.php
+++ b/app/Notifications/Admin/UserInvitation.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Notifications\Admin;
use FireflyIII\Models\InvitedUser;
use FireflyIII\Support\Notifications\UrlValidator;
-use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
diff --git a/app/Notifications/Admin/VersionCheckResult.php b/app/Notifications/Admin/VersionCheckResult.php
index 95af203bfd..ac0c195457 100644
--- a/app/Notifications/Admin/VersionCheckResult.php
+++ b/app/Notifications/Admin/VersionCheckResult.php
@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Notifications\Admin;
use FireflyIII\Support\Notifications\UrlValidator;
-use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php
index 0e6ddd5cdb..b93436c782 100644
--- a/app/Notifications/User/UserLogin.php
+++ b/app/Notifications/User/UserLogin.php
@@ -29,9 +29,9 @@ use FireflyIII\Support\Notifications\UrlValidator;
use FireflyIII\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
-use Illuminate\Notifications\Messages\SlackMessage;
/**
* Class UserLogin
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index c71588decc..5094305b08 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -28,7 +28,6 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Laravel\Passport\Passport;
use Laravel\Sanctum\Sanctum;
-use URL;
/**
* Class AppServiceProvider
diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php
index fa8dd0c960..0dee21d3b6 100644
--- a/app/Providers/JournalServiceProvider.php
+++ b/app/Providers/JournalServiceProvider.php
@@ -31,10 +31,10 @@ use FireflyIII\Repositories\Journal\JournalCLIRepository;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepository;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
-use FireflyIII\Repositories\UserGroups\Journal\JournalRepository as GroupJournalRepository;
-use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface as GroupJournalRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepository;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Journal\JournalRepository as GroupJournalRepository;
+use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface as GroupJournalRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php
index 061bc311c0..4c60ba9ff5 100644
--- a/app/Providers/PiggyBankServiceProvider.php
+++ b/app/Providers/PiggyBankServiceProvider.php
@@ -25,10 +25,8 @@ namespace FireflyIII\Providers;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepository;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
-
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepository as AdminPiggyBankRepository;
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface as AdminPiggyBankRepositoryInterface;
-
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 52e78dba52..ad98dae7cc 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -38,7 +38,6 @@ use FireflyIII\Models\RuleAction;
use FireflyIII\Models\RuleTrigger;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
-use FireflyIII\Repositories\Currency\CurrencyRepository;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\BudgetDestroyService;
use FireflyIII\User;
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 6811f3a869..bf34aa5c94 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -262,6 +262,16 @@ class JournalRepository implements JournalRepositoryInterface
}
}
+ /**
+ * @inheritDoc
+ */
+ public function unreconcileById(int $journalId): void
+ {
+ /** @var TransactionJournal $journal */
+ $journal = $this->user->transactionJournals()->find($journalId);
+ $journal?->transactions()->update(['reconciled' => false]);
+ }
+
/**
* Update budget for a journal.
*
@@ -334,14 +344,4 @@ class JournalRepository implements JournalRepositoryInterface
return $journal;
}
-
- /**
- * @inheritDoc
- */
- public function unreconcileById(int $journalId): void
- {
- /** @var TransactionJournal $journal */
- $journal = $this->user->transactionJournals()->find($journalId);
- $journal?->transactions()->update(['reconciled' => false]);
- }
}
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index 34c5af0d09..a188d40c47 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -133,13 +133,6 @@ interface JournalRepositoryInterface
*/
public function reconcileById(int $journalId): void;
- /**
- * TODO Maybe to account repository? Do this wen reconcile is API only.
- *
- * @param int $journalId
- */
- public function unreconcileById(int $journalId): void;
-
/**
* Search in journal descriptions.
*
@@ -155,6 +148,13 @@ interface JournalRepositoryInterface
*/
public function setUser(User | Authenticatable | null $user): void;
+ /**
+ * TODO Maybe to account repository? Do this wen reconcile is API only.
+ *
+ * @param int $journalId
+ */
+ public function unreconcileById(int $journalId): void;
+
/**
* Update budget for a journal.
*
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 061ad83872..937d504af7 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -30,7 +30,6 @@ use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
-use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
index 5556f67954..12efef6f58 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Currency;
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
index 9ac532976f..05b9699fe6 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Currency;
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 70de7c23c1..f5f44aafd1 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -31,8 +31,6 @@ use FireflyIII\User;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Collection;
use NumberFormatter;
-use Psr\Container\ContainerExceptionInterface;
-use Psr\Container\NotFoundExceptionInterface;
/**
* Class Amount.
@@ -140,7 +138,7 @@ class Amount
return $cache->get();
}
$default = $user->currencies()->where('user_default', true)->first();
- if(null === $default) {
+ if (null === $default) {
$default = $this->getSystemCurrency();
$user->currencies()->sync([$default->id => ['user_default' => true]]);
}
@@ -148,6 +146,15 @@ class Amount
return $default;
}
+
+ /**
+ * @return TransactionCurrency
+ */
+ public function getSystemCurrency(): TransactionCurrency
+ {
+ return TransactionCurrency::where('code', 'EUR')->first();
+ }
+
/**
* @param User $user
*
@@ -162,7 +169,7 @@ class Amount
return $cache->get();
}
$default = $userGroup->currencies()->where('group_default', true)->first();
- if(null === $default) {
+ if (null === $default) {
$default = $this->getSystemCurrency();
$userGroup->currencies()->sync([$default->id => ['group_default' => true]]);
}
@@ -171,22 +178,6 @@ class Amount
return $default;
}
- /**
- * @param string $value
- *
- * @return string
- */
- private function tryDecrypt(string $value): string
- {
- try {
- $value = Crypt::decrypt($value); // verified
- } catch (DecryptException $e) {
- // @ignoreException
- }
-
- return $value;
- }
-
/**
* This method returns the correct format rules required by accounting.js,
* the library used to format amounts in charts.
@@ -328,10 +319,18 @@ class Amount
}
/**
- * @return TransactionCurrency
+ * @param string $value
+ *
+ * @return string
*/
- public function getSystemCurrency(): TransactionCurrency
+ private function tryDecrypt(string $value): string
{
- return TransactionCurrency::where('code', 'EUR')->first();
+ try {
+ $value = Crypt::decrypt($value); // verified
+ } catch (DecryptException $e) {
+ // @ignoreException
+ }
+
+ return $value;
}
}
diff --git a/app/Support/Binder/UserGroupAccount.php b/app/Support/Binder/UserGroupAccount.php
index b70d19183d..f8b7824912 100644
--- a/app/Support/Binder/UserGroupAccount.php
+++ b/app/Support/Binder/UserGroupAccount.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Binder;
use FireflyIII\Models\Account;
use FireflyIII\User;
use Illuminate\Routing\Route;
-use Illuminate\Support\Collection;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
diff --git a/app/Support/Form/RuleForm.php b/app/Support/Form/RuleForm.php
index 577f34dc6b..522e2f0729 100644
--- a/app/Support/Form/RuleForm.php
+++ b/app/Support/Form/RuleForm.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Form;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use Form;
-use Illuminate\Support\HtmlString;
/**
* Class RuleForm
diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.php
index 6e0f2bfd77..214b7e9d06 100644
--- a/app/Support/Http/Api/ConvertsExchangeRates.php
+++ b/app/Support/Http/Api/ConvertsExchangeRates.php
@@ -26,10 +26,7 @@ namespace FireflyIII\Support\Http\Api;
use Carbon\Carbon;
use DateTimeInterface;
-use FireflyIII\Exceptions\FireflyException;
-use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
-use FireflyIII\Support\CacheProperties;
/**
* Trait ConvertsExchangeRates
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 0b6ba764b6..fbd3e3a0ab 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -58,7 +58,7 @@ class Navigation
*/
public function addPeriod(Carbon $theDate, string $repeatFreq, int $skip = 0): Carbon
{
- $date = clone $theDate;
+ $date = clone $theDate;
$functionMap = [
'1D' => Periodicity::Daily,
'daily' => Periodicity::Daily,
@@ -351,8 +351,13 @@ class Navigation
*/
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
{
- app('log')->debug(sprintf('diffInPeriods: %s (skip: %d), between %s and %s.',
- $period, $skip, $beginning->format('Y-m-d'), $end->format('Y-m-d')));
+ app('log')->debug(sprintf(
+ 'diffInPeriods: %s (skip: %d), between %s and %s.',
+ $period,
+ $skip,
+ $beginning->format('Y-m-d'),
+ $end->format('Y-m-d')
+ ));
$map = [
'daily' => 'floatDiffInDays',
'weekly' => 'floatDiffInWeeks',
@@ -370,11 +375,11 @@ class Navigation
$diff = $beginning->$func($end);
// then correct for quarterly or half-year
- if('quarterly' === $period) {
+ if ('quarterly' === $period) {
app('log')->debug(sprintf('Q: Corrected %f to %f', $diff, $diff / 3));
$diff = $diff / 3;
}
- if('half-year' === $period) {
+ if ('half-year' === $period) {
app('log')->debug(sprintf('H: Corrected %f to %f', $diff, $diff / 6));
$diff = $diff / 6;
}
@@ -384,11 +389,15 @@ class Navigation
app('log')->debug(sprintf('Diff is %f (%d)', $beginning->$func($end), $diff));
- if($skip > 0) {
+ if ($skip > 0) {
$parameter = $skip + 1;
- $diff = ceil($diff / $parameter) * $parameter;
- app('log')->debug(sprintf('diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
- $skip, $parameter, $diff));
+ $diff = ceil($diff / $parameter) * $parameter;
+ app('log')->debug(sprintf(
+ 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
+ $skip,
+ $parameter,
+ $diff
+ ));
}
return (int)$diff;
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 46a1a91d28..9aa647b04b 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -60,7 +60,7 @@ class Preferences
*/
public function get(string $name, $default = null): ?Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
/** @var User|null $user */
@@ -85,7 +85,7 @@ class Preferences
*/
public function getForUser(User $user, string $name, $default = null): ?Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
$preference = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
@@ -114,7 +114,7 @@ class Preferences
*/
public function delete(string $name): bool
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
$fullName = sprintf('preference%s%s', auth()->user()->id, $name);
@@ -132,7 +132,7 @@ class Preferences
*/
public function forget(User $user, string $name): void
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
$key = sprintf('preference%s%s', $user->id, $name);
@@ -150,7 +150,7 @@ class Preferences
*/
public function setForUser(User $user, string $name, $value): Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
$fullName = sprintf('preference%s%s', $user->id, $name);
@@ -200,7 +200,7 @@ class Preferences
*/
public function findByName(string $name): Collection
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
return Preference::where('name', $name)->get();
@@ -238,7 +238,7 @@ class Preferences
*/
public function getFresh(string $name, $default = null): ?Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
/** @var User|null $user */
@@ -264,7 +264,7 @@ class Preferences
*/
public function getFreshForUser(User $user, string $name, $default = null): ?Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
return $this->getForUser($user, $name, $default);
@@ -307,7 +307,7 @@ class Preferences
*/
public function set(string $name, $value): Preference
{
- if('currencyPreference' === $name) {
+ if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
$user = auth()->user();
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 664dbdff66..ff1ff1c568 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -34,8 +34,8 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
-use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\ParseDateString;
use FireflyIII\User;
use Gdbots\QueryParser\Enum\BoolOperator;
diff --git a/app/TransactionRules/Actions/SwitchAccounts.php b/app/TransactionRules/Actions/SwitchAccounts.php
index 29d71b6bcc..0839dcf5ae 100644
--- a/app/TransactionRules/Actions/SwitchAccounts.php
+++ b/app/TransactionRules/Actions/SwitchAccounts.php
@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
-use DB;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\RuleAction;
diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php
index eb0022d035..97196f272c 100644
--- a/app/Transformers/BillTransformer.php
+++ b/app/Transformers/BillTransformer.php
@@ -60,17 +60,17 @@ class BillTransformer extends AbstractTransformer
$paidData = $this->paidData($bill);
$payDates = $this->payDates($bill);
$currency = $bill->transactionCurrency;
- $notes = $this->repository->getNoteText($bill);
- $notes = '' === $notes ? null : $notes;
+ $notes = $this->repository->getNoteText($bill);
+ $notes = '' === $notes ? null : $notes;
$this->repository->setUser($bill->user);
- $objectGroupId = null;
+ $objectGroupId = null;
$objectGroupOrder = null;
$objectGroupTitle = null;
/** @var ObjectGroup $objectGroup */
$objectGroup = $bill->objectGroups->first();
if (null !== $objectGroup) {
- $objectGroupId = (int)$objectGroup->id;
+ $objectGroupId = (int)$objectGroup->id;
$objectGroupOrder = (int)$objectGroup->order;
$objectGroupTitle = $objectGroup->title;
}
@@ -78,7 +78,7 @@ class BillTransformer extends AbstractTransformer
$paidDataFormatted = [];
$payDatesFormatted = [];
foreach ($paidData['paid_dates'] as $object) {
- $object['date'] = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'))->toAtomString();
+ $object['date'] = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'))->toAtomString();
$paidDataFormatted[] = $object;
}
@@ -98,40 +98,40 @@ class BillTransformer extends AbstractTransformer
$current = $payDatesFormatted[0] ?? null;
if (null !== $current && !$temp->isToday()) {
- $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
+ $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
$nextExpectedMatchDiff = $temp2->diffForHumans(today(config('app.timezone')), CarbonInterface::DIFF_RELATIVE_TO_NOW);
}
unset($temp, $temp2);
return [
- 'id' => (int)$bill->id,
- 'created_at' => $bill->created_at->toAtomString(),
- 'updated_at' => $bill->updated_at->toAtomString(),
- 'currency_id' => (string)$bill->transaction_currency_id,
- 'currency_code' => $currency->code,
- 'currency_symbol' => $currency->symbol,
- 'currency_decimal_places' => (int)$currency->decimal_places,
- 'name' => $bill->name,
- 'amount_min' => app('steam')->bcround($bill->amount_min, $currency->decimal_places),
- 'amount_max' => app('steam')->bcround($bill->amount_max, $currency->decimal_places),
- 'date' => $bill->date->toAtomString(),
- 'end_date' => $bill->end_date?->toAtomString(),
- 'extension_date' => $bill->extension_date?->toAtomString(),
- 'repeat_freq' => $bill->repeat_freq,
- 'skip' => (int)$bill->skip,
- 'active' => $bill->active,
- 'order' => (int)$bill->order,
- 'notes' => $notes,
- 'object_group_id' => $objectGroupId ? (string)$objectGroupId : null,
- 'object_group_order' => $objectGroupOrder,
- 'object_group_title' => $objectGroupTitle,
+ 'id' => (int)$bill->id,
+ 'created_at' => $bill->created_at->toAtomString(),
+ 'updated_at' => $bill->updated_at->toAtomString(),
+ 'currency_id' => (string)$bill->transaction_currency_id,
+ 'currency_code' => $currency->code,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_decimal_places' => (int)$currency->decimal_places,
+ 'name' => $bill->name,
+ 'amount_min' => app('steam')->bcround($bill->amount_min, $currency->decimal_places),
+ 'amount_max' => app('steam')->bcround($bill->amount_max, $currency->decimal_places),
+ 'date' => $bill->date->toAtomString(),
+ 'end_date' => $bill->end_date?->toAtomString(),
+ 'extension_date' => $bill->extension_date?->toAtomString(),
+ 'repeat_freq' => $bill->repeat_freq,
+ 'skip' => (int)$bill->skip,
+ 'active' => $bill->active,
+ 'order' => (int)$bill->order,
+ 'notes' => $notes,
+ 'object_group_id' => $objectGroupId ? (string)$objectGroupId : null,
+ 'object_group_order' => $objectGroupOrder,
+ 'object_group_title' => $objectGroupTitle,
// these fields need work:
- 'next_expected_match' => $nextExpectedMatch,
+ 'next_expected_match' => $nextExpectedMatch,
'next_expected_match_diff' => $nextExpectedMatchDiff,
- 'pay_dates' => $payDatesFormatted,
- 'paid_dates' => $paidDataFormatted,
- 'links' => [
+ 'pay_dates' => $payDatesFormatted,
+ 'paid_dates' => $paidDataFormatted,
+ 'links' => [
[
'rel' => 'self',
'uri' => '/bills/' . $bill->id,
@@ -154,7 +154,7 @@ class BillTransformer extends AbstractTransformer
app('log')->debug('parameters are NULL, return empty array');
return [
- 'paid_dates' => [],
+ 'paid_dates' => [],
'next_expected_match' => null,
];
}
@@ -162,7 +162,7 @@ class BillTransformer extends AbstractTransformer
// 2023-07-18 this particular date is used to search for the last paid date.
// 2023-07-18 the cloned $searchDate is used to grab the correct transactions.
/** @var Carbon $start */
- $start = clone $this->parameters->get('start');
+ $start = clone $this->parameters->get('start');
$searchStart = clone $start;
$start->subDay();
@@ -189,7 +189,7 @@ class BillTransformer extends AbstractTransformer
/*
* Diff in months (or other period) between bill start and last paid date or $start.
*/
- $steps = app('navigation')->diffInPeriods($bill->repeat_freq, $bill->skip, $start, $nextMatch);
+ $steps = app('navigation')->diffInPeriods($bill->repeat_freq, $bill->skip, $start, $nextMatch);
$nextMatch = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $steps);
if ($nextMatch->lt($lastPaidDate)) {
@@ -213,16 +213,16 @@ class BillTransformer extends AbstractTransformer
$result = [];
foreach ($set as $entry) {
$result[] = [
- 'transaction_group_id' => (int)$entry->transaction_group_id,
+ 'transaction_group_id' => (int)$entry->transaction_group_id,
'transaction_journal_id' => (int)$entry->id,
- 'date' => $entry->date->format('Y-m-d'),
+ 'date' => $entry->date->format('Y-m-d'),
];
}
app('log')->debug(sprintf('Next match: %s', $nextMatch->toIso8601String()));
return [
- 'paid_dates' => $result,
+ 'paid_dates' => $result,
'next_expected_match' => $nextMatch->format('Y-m-d'),
];
}
@@ -231,7 +231,7 @@ class BillTransformer extends AbstractTransformer
* Returns the latest date in the set, or start when set is empty.
*
* @param Collection $dates
- * @param Carbon $default
+ * @param Carbon $default
*
* @return Carbon
*/
@@ -265,7 +265,7 @@ class BillTransformer extends AbstractTransformer
return [];
}
app('log')->debug(sprintf('Start: %s, end: %s', $this->parameters->get('start')->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));
- $set = new Collection();
+ $set = new Collection();
$currentStart = clone $this->parameters->get('start');
// 2023-06-23 subDay to fix 7655
$currentStart->subDay();
@@ -303,7 +303,7 @@ class BillTransformer extends AbstractTransformer
}
app('log')->debug(sprintf('Next expected match is %s', $nextExpectedMatch->format('Y-m-d')));
// add to set, if the date is ON or after the start parameter
- if($nextExpectedMatch->gte($this->parameters->get('start'))) {
+ if ($nextExpectedMatch->gte($this->parameters->get('start'))) {
$set->push(clone $nextExpectedMatch);
}
@@ -334,7 +334,7 @@ class BillTransformer extends AbstractTransformer
* Given a bill and a date, this method will tell you at which moment this bill expects its next
* transaction. That date must be AFTER $date as a sanity check.
*
- * @param Bill $bill
+ * @param Bill $bill
* @param Carbon $date
*
* @return Carbon
@@ -349,7 +349,7 @@ class BillTransformer extends AbstractTransformer
return clone $start;
}
- $steps = app('navigation')->diffInPeriods($bill->repeat_freq, $bill->skip, $start, $date);
+ $steps = app('navigation')->diffInPeriods($bill->repeat_freq, $bill->skip, $start, $date);
$result = clone $start;
if ($steps > 0) {
$steps = $steps - 1;
diff --git a/app/Transformers/CurrencyTransformer.php b/app/Transformers/CurrencyTransformer.php
index 0449db14b3..2764bde256 100644
--- a/app/Transformers/CurrencyTransformer.php
+++ b/app/Transformers/CurrencyTransformer.php
@@ -34,6 +34,7 @@ class CurrencyTransformer extends AbstractTransformer
* Transform the currency.
*
* @param TransactionCurrency $currency
+ *
* @return array
*/
public function transform(TransactionCurrency $currency): array
diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php
index ddc95d7ef4..a480c05d9d 100644
--- a/app/Transformers/RecurrenceTransformer.php
+++ b/app/Transformers/RecurrenceTransformer.php
@@ -34,7 +34,6 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
-use Illuminate\Support\Facades\Log;
/**
*
diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php
index cb12faa4de..35ce7ac32e 100644
--- a/app/Transformers/TransactionGroupTransformer.php
+++ b/app/Transformers/TransactionGroupTransformer.php
@@ -36,7 +36,6 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Support\NullArrayObject;
use Illuminate\Support\Collection;
-use Illuminate\Support\Facades\Log;
/**
* Class TransactionGroupTransformer
diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php
index 4a2ab80572..8a192d121b 100644
--- a/app/Transformers/V2/AccountTransformer.php
+++ b/app/Transformers/V2/AccountTransformer.php
@@ -58,8 +58,8 @@ class AccountTransformer extends AbstractTransformer
$this->convertedBalances = app('steam')->balancesByAccountsConverted($objects, $this->getDate());
/** @var CurrencyRepositoryInterface $repository */
- $repository = app(CurrencyRepositoryInterface::class);
- $this->default = app('amount')->getDefaultCurrency();
+ $repository = app(CurrencyRepositoryInterface::class);
+ $this->default = app('amount')->getDefaultCurrency();
// get currencies:
$accountIds = $objects->pluck('id')->toArray();
diff --git a/app/Transformers/V2/BillTransformer.php b/app/Transformers/V2/BillTransformer.php
index 4dae4997c5..5d0ec63965 100644
--- a/app/Transformers/V2/BillTransformer.php
+++ b/app/Transformers/V2/BillTransformer.php
@@ -35,7 +35,6 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
-use Log;
/**
* Class BillTransformer
diff --git a/app/Transformers/WebhookMessageTransformer.php b/app/Transformers/WebhookMessageTransformer.php
index 02a290a069..2ffaa2911c 100644
--- a/app/Transformers/WebhookMessageTransformer.php
+++ b/app/Transformers/WebhookMessageTransformer.php
@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Transformers;
use FireflyIII\Models\WebhookMessage;
-use Illuminate\Support\Facades\Log;
use Jsonexception;
/**
diff --git a/app/User.php b/app/User.php
index f4575642d6..0effda5f39 100644
--- a/app/User.php
+++ b/app/User.php
@@ -80,39 +80,39 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class User.
*
- * @property int $id
- * @property string $email
- * @property bool $isAdmin
- * @property bool $has2FA
- * @property array $prefs
- * @property string $password
- * @property string $mfa_secret
- * @property Collection $roles
- * @property string $blocked_code
- * @property bool $blocked
- * @property Carbon|null $created_at
- * @property Carbon|null $updated_at
- * @property string|null $remember_token
- * @property string|null $reset
- * @property-read \Illuminate\Database\Eloquent\Collection|Account[] $accounts
- * @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
- * @property-read \Illuminate\Database\Eloquent\Collection|AvailableBudget[] $availableBudgets
- * @property-read \Illuminate\Database\Eloquent\Collection|Bill[] $bills
- * @property-read \Illuminate\Database\Eloquent\Collection|Budget[] $budgets
- * @property-read \Illuminate\Database\Eloquent\Collection|Category[] $categories
- * @property-read \Illuminate\Database\Eloquent\Collection|Client[] $clients
- * @property-read \Illuminate\Database\Eloquent\Collection|CurrencyExchangeRate[] $currencyExchangeRates
- * @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
- * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBank[] $piggyBanks
- * @property-read \Illuminate\Database\Eloquent\Collection|Preference[] $preferences
- * @property-read \Illuminate\Database\Eloquent\Collection|Recurrence[] $recurrences
- * @property-read \Illuminate\Database\Eloquent\Collection|RuleGroup[] $ruleGroups
- * @property-read \Illuminate\Database\Eloquent\Collection|Rule[] $rules
- * @property-read \Illuminate\Database\Eloquent\Collection|Tag[] $tags
- * @property-read \Illuminate\Database\Eloquent\Collection|Token[] $tokens
- * @property-read \Illuminate\Database\Eloquent\Collection|TransactionGroup[] $transactionGroups
- * @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
- * @property-read \Illuminate\Database\Eloquent\Collection|Transaction[] $transactions
+ * @property int $id
+ * @property string $email
+ * @property bool $isAdmin
+ * @property bool $has2FA
+ * @property array $prefs
+ * @property string $password
+ * @property string $mfa_secret
+ * @property Collection $roles
+ * @property string $blocked_code
+ * @property bool $blocked
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property string|null $remember_token
+ * @property string|null $reset
+ * @property-read \Illuminate\Database\Eloquent\Collection|Account[] $accounts
+ * @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
+ * @property-read \Illuminate\Database\Eloquent\Collection|AvailableBudget[] $availableBudgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|Bill[] $bills
+ * @property-read \Illuminate\Database\Eloquent\Collection|Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|Category[] $categories
+ * @property-read \Illuminate\Database\Eloquent\Collection|Client[] $clients
+ * @property-read \Illuminate\Database\Eloquent\Collection|CurrencyExchangeRate[] $currencyExchangeRates
+ * @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
+ * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBank[] $piggyBanks
+ * @property-read \Illuminate\Database\Eloquent\Collection|Preference[] $preferences
+ * @property-read \Illuminate\Database\Eloquent\Collection|Recurrence[] $recurrences
+ * @property-read \Illuminate\Database\Eloquent\Collection|RuleGroup[] $ruleGroups
+ * @property-read \Illuminate\Database\Eloquent\Collection|Rule[] $rules
+ * @property-read \Illuminate\Database\Eloquent\Collection|Tag[] $tags
+ * @property-read \Illuminate\Database\Eloquent\Collection|Token[] $tokens
+ * @property-read \Illuminate\Database\Eloquent\Collection|TransactionGroup[] $transactionGroups
+ * @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
+ * @property-read \Illuminate\Database\Eloquent\Collection|Transaction[] $transactions
* @method static Builder|User newModelQuery()
* @method static Builder|User newQuery()
* @method static Builder|User query()
@@ -125,50 +125,50 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|User whereRememberToken($value)
* @method static Builder|User whereReset($value)
* @method static Builder|User whereUpdatedAt($value)
- * @property string|null $objectguid
- * @property-read int|null $accounts_count
- * @property-read int|null $attachments_count
- * @property-read int|null $available_budgets_count
- * @property-read int|null $bills_count
- * @property-read int|null $budgets_count
- * @property-read int|null $categories_count
- * @property-read int|null $clients_count
- * @property-read int|null $currency_exchange_rates_count
- * @property-read int|null $notifications_count
- * @property-read int|null $piggy_banks_count
- * @property-read int|null $preferences_count
- * @property-read int|null $recurrences_count
- * @property-read int|null $roles_count
- * @property-read int|null $rule_groups_count
- * @property-read int|null $rules_count
- * @property-read int|null $tags_count
- * @property-read int|null $tokens_count
- * @property-read int|null $transaction_groups_count
- * @property-read int|null $transaction_journals_count
- * @property-read int|null $transactions_count
+ * @property string|null $objectguid
+ * @property-read int|null $accounts_count
+ * @property-read int|null $attachments_count
+ * @property-read int|null $available_budgets_count
+ * @property-read int|null $bills_count
+ * @property-read int|null $budgets_count
+ * @property-read int|null $categories_count
+ * @property-read int|null $clients_count
+ * @property-read int|null $currency_exchange_rates_count
+ * @property-read int|null $notifications_count
+ * @property-read int|null $piggy_banks_count
+ * @property-read int|null $preferences_count
+ * @property-read int|null $recurrences_count
+ * @property-read int|null $roles_count
+ * @property-read int|null $rule_groups_count
+ * @property-read int|null $rules_count
+ * @property-read int|null $tags_count
+ * @property-read int|null $tokens_count
+ * @property-read int|null $transaction_groups_count
+ * @property-read int|null $transaction_journals_count
+ * @property-read int|null $transactions_count
* @method static Builder|User whereMfaSecret($value)
* @method static Builder|User whereObjectguid($value)
- * @property string|null $provider
+ * @property string|null $provider
* @method static Builder|User whereProvider($value)
- * @property-read \Illuminate\Database\Eloquent\Collection|ObjectGroup[] $objectGroups
- * @property-read int|null $object_groups_count
- * @property-read \Illuminate\Database\Eloquent\Collection|Webhook[] $webhooks
- * @property-read int|null $webhooks_count
- * @property string|null $two_factor_secret
- * @property string|null $two_factor_recovery_codes
- * @property string|null $guid
- * @property string|null $domain
+ * @property-read \Illuminate\Database\Eloquent\Collection|ObjectGroup[] $objectGroups
+ * @property-read int|null $object_groups_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|Webhook[] $webhooks
+ * @property-read int|null $webhooks_count
+ * @property string|null $two_factor_secret
+ * @property string|null $two_factor_recovery_codes
+ * @property string|null $guid
+ * @property string|null $domain
* @method static Builder|User whereDomain($value)
* @method static Builder|User whereGuid($value)
* @method static Builder|User whereTwoFactorRecoveryCodes($value)
* @method static Builder|User whereTwoFactorSecret($value)
- * @property int|null $user_group_id
- * @property-read \Illuminate\Database\Eloquent\Collection|GroupMembership[] $groupMemberships
- * @property-read int|null $group_memberships_count
- * @property-read UserGroup|null $userGroup
+ * @property int|null $user_group_id
+ * @property-read \Illuminate\Database\Eloquent\Collection|GroupMembership[] $groupMemberships
+ * @property-read int|null $group_memberships_count
+ * @property-read UserGroup|null $userGroup
* @method static Builder|User whereUserGroupId($value)
* @property-read \Illuminate\Database\Eloquent\Collection<int, TransactionCurrency> $currencies
- * @property-read int|null $currencies_count
+ * @property-read int|null $currencies_count
* @mixin Eloquent
*/
class User extends Authenticatable
@@ -234,16 +234,6 @@ class User extends Authenticatable
return $this->hasMany(Account::class);
}
- /**
- * Link to currencies
- *
- * @return BelongsToMany
- */
- public function currencies(): BelongsToMany
- {
- return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('user_default');
- }
-
/**
* Link to attachments
*
@@ -294,6 +284,16 @@ class User extends Authenticatable
return $this->hasMany(Category::class);
}
+ /**
+ * Link to currencies
+ *
+ * @return BelongsToMany
+ */
+ public function currencies(): BelongsToMany
+ {
+ return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('user_default');
+ }
+
/**
* Link to currency exchange rates
*
diff --git a/app/Validation/GroupValidation.php b/app/Validation/GroupValidation.php
index 025a5b2d40..29fb2511f3 100644
--- a/app/Validation/GroupValidation.php
+++ b/app/Validation/GroupValidation.php
@@ -27,7 +27,6 @@ namespace FireflyIII\Validation;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionGroup;
-use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
@@ -38,44 +37,6 @@ use Illuminate\Validation\Validator;
*/
trait GroupValidation
{
- /**
- * @param Validator $validator
- * @param TransactionGroup $transactionGroup
- *
- * @return void
- */
- protected function preventUpdateReconciled(Validator $validator, TransactionGroup $transactionGroup): void
- {
- app('log')->debug(sprintf('Now in %s', __METHOD__));
-
- $count = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
- ->leftJoin('transaction_groups', 'transaction_groups.id', 'transaction_journals.transaction_group_id')
- ->where('transaction_journals.transaction_group_id', $transactionGroup->id)
- ->where('transactions.reconciled', 1)->where('transactions.amount', '<', 0)->count(['transactions.id']);
- if (0 === $count) {
- app('log')->debug(sprintf('Transaction is not reconciled, done with %s', __METHOD__));
- return;
- }
- $data = $validator->getData();
- $forbidden = ['amount','foreign_amount','currency_code','currency_id','foreign_currency_code','foreign_currency_id',
- 'source_id','source_name','source_number','source_iban',
- 'destination_id','destination_name','destination_number','destination_iban',
- ];
- foreach($data['transactions'] as $index => $row) {
- foreach($forbidden as $key) {
- if(array_key_exists($key, $row)) {
- $validator->errors()->add(
- sprintf('transactions.%d.%s', $index, $key),
- (string)trans('validation.reconciled_forbidden_field', ['field' => $key])
- );
- }
- }
- }
-
- app('log')->debug(sprintf('Done with %s', __METHOD__));
- }
-
-
/**
* A catch when users submit splits with no source or destination info at all.
*
@@ -133,6 +94,43 @@ trait GroupValidation
*/
abstract protected function getTransactionsArray(Validator $validator): array;
+ /**
+ * @param Validator $validator
+ * @param TransactionGroup $transactionGroup
+ *
+ * @return void
+ */
+ protected function preventUpdateReconciled(Validator $validator, TransactionGroup $transactionGroup): void
+ {
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
+
+ $count = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
+ ->leftJoin('transaction_groups', 'transaction_groups.id', 'transaction_journals.transaction_group_id')
+ ->where('transaction_journals.transaction_group_id', $transactionGroup->id)
+ ->where('transactions.reconciled', 1)->where('transactions.amount', '<', 0)->count(['transactions.id']);
+ if (0 === $count) {
+ app('log')->debug(sprintf('Transaction is not reconciled, done with %s', __METHOD__));
+ return;
+ }
+ $data = $validator->getData();
+ $forbidden = ['amount', 'foreign_amount', 'currency_code', 'currency_id', 'foreign_currency_code', 'foreign_currency_id',
+ 'source_id', 'source_name', 'source_number', 'source_iban',
+ 'destination_id', 'destination_name', 'destination_number', 'destination_iban',
+ ];
+ foreach ($data['transactions'] as $index => $row) {
+ foreach ($forbidden as $key) {
+ if (array_key_exists($key, $row)) {
+ $validator->errors()->add(
+ sprintf('transactions.%d.%s', $index, $key),
+ (string)trans('validation.reconciled_forbidden_field', ['field' => $key])
+ );
+ }
+ }
+ }
+
+ app('log')->debug(sprintf('Done with %s', __METHOD__));
+ }
+
/**
* Adds an error to the "description" field when the user has submitted no descriptions and no
* journal description.
diff --git a/bootstrap/app.php b/bootstrap/app.php
index b7cac40a4c..c6dadd7ee1 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -41,7 +41,8 @@ if (!function_exists('envNonEmpty')) {
*
* @return mixed|null
*/
- function envNonEmpty(string $key, $default = null) {
+ function envNonEmpty(string $key, $default = null)
+ {
$result = env($key, $default);
if (is_string($result) && '' === $result) {
$result = $default;
@@ -58,7 +59,8 @@ if (!function_exists('stringIsEqual')) {
*
* @return bool
*/
- function stringIsEqual(string $left, string $right): bool {
+ function stringIsEqual(string $left, string $right): bool
+ {
return $left === $right;
}
}
diff --git a/config/broadcasting.php b/config/broadcasting.php
index 933bd64870..9f892e15a0 100644
--- a/config/broadcasting.php
+++ b/config/broadcasting.php
@@ -51,17 +51,17 @@ return [
'connections' => [
'pusher' => [
- 'driver' => 'pusher',
- 'key' => env('PUSHER_APP_KEY'),
- 'secret' => env('PUSHER_APP_SECRET'),
- 'app_id' => env('PUSHER_APP_ID'),
- 'options' => [
- 'cluster' => env('PUSHER_APP_CLUSTER'),
- 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
- 'port' => env('PUSHER_PORT', 443),
- 'scheme' => env('PUSHER_SCHEME', 'https'),
+ 'driver' => 'pusher',
+ 'key' => env('PUSHER_APP_KEY'),
+ 'secret' => env('PUSHER_APP_SECRET'),
+ 'app_id' => env('PUSHER_APP_ID'),
+ 'options' => [
+ 'cluster' => env('PUSHER_APP_CLUSTER'),
+ 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',
+ 'port' => env('PUSHER_PORT', 443),
+ 'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
- 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
+ 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
@@ -70,11 +70,11 @@ return [
'ably' => [
'driver' => 'ably',
- 'key' => env('ABLY_KEY'),
+ 'key' => env('ABLY_KEY'),
],
'redis' => [
- 'driver' => 'redis',
+ 'driver' => 'redis',
'connection' => 'default',
],
diff --git a/database/seeders/ConfigSeeder.php b/database/seeders/ConfigSeeder.php
index b1ade84b80..3f7fece659 100644
--- a/database/seeders/ConfigSeeder.php
+++ b/database/seeders/ConfigSeeder.php
@@ -25,7 +25,6 @@ namespace Database\Seeders;
use FireflyIII\Models\Configuration;
use Illuminate\Database\Seeder;
-use Log;
/**
* Class ConfigSeeder.