Refactor and renam commands.

This commit is contained in:
James Cole
2024-12-27 06:48:58 +01:00
parent a3ff73903a
commit 2314ce8004
37 changed files with 153 additions and 184 deletions

View File

@@ -1,4 +1,23 @@
<?php <?php
/*
* ConvertsDatesToUTC.php
* Copyright (c) 2024 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1); declare(strict_types=1);
/* /*
@@ -21,7 +40,7 @@ declare(strict_types=1);
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
namespace FireflyIII\Console\Commands\Integrity; namespace FireflyIII\Console\Commands\Correction;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
@@ -54,6 +73,8 @@ class ConvertDatesToUTC extends Command
*/ */
public function handle(): int public function handle(): int
{ {
$this->friendlyWarning('Please do not use this command.');
return 0;
/** /**
* @var string $model * @var string $model
* @var array $fields * @var array $fields

View File

@@ -34,7 +34,7 @@ class CorrectDatabase extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Will correct the integrity of your database, if necessary.'; protected $description = 'Will validate and correct the integrity of your database, if necessary.';
protected $signature = 'firefly-iii:correct-database'; protected $signature = 'firefly-iii:correct-database';
/** /**
@@ -49,6 +49,14 @@ class CorrectDatabase extends Command
return 1; return 1;
} }
$commands = [ $commands = [
// also just in case, some integrity commands:
// 'upgrade:restore-oauth-keys',
// 'upgrade:add-timezones-to-dates',
// 'upgrade:create-group-memberships',
// 'upgrade:upgrade-group-information',
// 'upgrade:610-currency-preferences',
// 'upgrade:620-piggy-banks',
'firefly-iii:fix-piggies', 'firefly-iii:fix-piggies',
'firefly-iii:create-link-types', 'firefly-iii:create-link-types',
'firefly-iii:create-access-tokens', 'firefly-iii:create-access-tokens',

View File

@@ -1,8 +1,8 @@
<?php <?php
/* /*
* UpdateGroupInformation.php * CorrectsGroupInformation.php
* Copyright (c) 2022 james@firefly-iii.org * Copyright (c) 2024 james@firefly-iii.org.
* *
* This file is part of Firefly III (https://github.com/firefly-iii). * This file is part of Firefly III (https://github.com/firefly-iii).
* *
@@ -17,12 +17,12 @@
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace FireflyIII\Console\Commands\Integrity; namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;

View File

@@ -1,4 +1,23 @@
<?php <?php
/*
* CorrectsTimezoneInformation.php
* Copyright (c) 2024 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1); declare(strict_types=1);
/* /*
@@ -21,7 +40,7 @@ declare(strict_types=1);
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
namespace FireflyIII\Console\Commands\Integrity; namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\AccountBalance; use FireflyIII\Models\AccountBalance;

View File

@@ -1,8 +1,8 @@
<?php <?php
/* /*
* CreateGroupMemberships.php * CreatesGroupMemberships.php
* Copyright (c) 2023 james@firefly-iii.org * Copyright (c) 2024 james@firefly-iii.org.
* *
* This file is part of Firefly III (https://github.com/firefly-iii). * This file is part of Firefly III (https://github.com/firefly-iii).
* *
@@ -17,12 +17,12 @@
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace FireflyIII\Console\Commands\Integrity; namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;

View File

@@ -1,8 +1,8 @@
<?php <?php
/** /*
* RestoreOAuthKeys.php * RestoresOAuthKeys.php
* Copyright (c) 2020 james@firefly-iii.org * Copyright (c) 2024 james@firefly-iii.org.
* *
* This file is part of Firefly III (https://github.com/firefly-iii). * This file is part of Firefly III (https://github.com/firefly-iii).
* *
@@ -17,12 +17,12 @@
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace FireflyIII\Console\Commands\Integrity; namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Support\System\OAuthKeys; use FireflyIII\Support\System\OAuthKeys;

View File

@@ -34,13 +34,13 @@ use Illuminate\Console\Command;
/** /**
* Class ReportEmptyObjects * Class ReportEmptyObjects
*/ */
class ReportEmptyObjects extends Command class ReportsEmptyObjects extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Reports on empty database objects.'; protected $description = 'Reports on empty database objects.';
protected $signature = 'firefly-iii:report-empty-objects'; protected $signature = 'integrity:empty-objects';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -30,7 +30,7 @@ use Illuminate\Console\Command;
/** /**
* Class ReportIntegrity * Class ReportIntegrity
*/ */
class ReportIntegrity extends Command class ReportsIntegrity extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -48,11 +48,9 @@ class ReportIntegrity extends Command
return 1; return 1;
} }
$commands = [ $commands = [
'firefly-iii:add-timezones-to-dates', //'firefly-iii:add-timezones-to-dates',
'firefly-iii:create-group-memberships', 'integrity:empty-objects',
'firefly-iii:report-empty-objects', 'integrity:total-sums',
'firefly-iii:report-sum',
'firefly-iii:upgrade-group-information',
]; ];
foreach ($commands as $command) { foreach ($commands as $command) {
$this->friendlyLine(sprintf('Now executing %s', $command)); $this->friendlyLine(sprintf('Now executing %s', $command));

View File

@@ -32,12 +32,13 @@ use Illuminate\Console\Command;
/** /**
* Class ReportSkeleton * Class ReportSkeleton
*/ */
class ReportSum extends Command class ReportsSums extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Report on the total sum of transactions. Must be 0.'; protected $description = 'Report on the total sum of transactions. Must be 0.';
protected $signature = 'firefly-iii:report-sum'; protected $signature = 'integrity:total-sums';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -35,13 +35,13 @@ use Illuminate\Database\QueryException;
/** /**
* Class TransactionIdentifier * Class TransactionIdentifier
*/ */
class TransactionIdentifier extends Command class AddsTransactionIdentifiers extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transaction_identifier'; public const string CONFIG_NAME = '480_transaction_identifier';
protected $description = 'Fixes transaction identifiers.'; protected $description = 'Fixes transaction identifiers.';
protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-transaction-identifiers {--F|force : Force the execution of this command.}';
private JournalCLIRepositoryInterface $cliRepository; private JournalCLIRepositoryInterface $cliRepository;
private int $count; private int $count;

View File

@@ -30,15 +30,12 @@ use FireflyIII\Models\Preference;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\DecryptException;
/** class RemovesDatabaseDecryption extends Command
* Class DecryptDatabase
*/
class DecryptDatabase extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Decrypts the database.'; protected $description = 'Decrypts the database.';
protected $signature = 'firefly-iii:decrypt-all'; protected $signature = 'upgrade:480-decrypt-all';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -28,16 +28,13 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Support\Models\AccountBalanceCalculator; use FireflyIII\Support\Models\AccountBalanceCalculator;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class RepairsAccountBalances extends Command
* Class CorrectionSkeleton
*/
class CorrectAccountBalance extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '610_correct_balances'; public const string CONFIG_NAME = '610_correct_balances';
protected $description = 'Recalculate all account balance amounts'; protected $description = 'Recalculate all account balance amounts';
protected $signature = 'firefly-iii:correct-account-balance {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:610-account-balances {--F|force : Force the execution of this command.}';
public function handle(): int public function handle(): int
{ {

View File

@@ -27,16 +27,13 @@ namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class RepairsPostgresSequences extends Command
* Class FixPostgresSequences
*/
class FixPostgresSequences extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Fixes issues with PostgreSQL sequences.'; protected $description = 'Fixes issues with PostgreSQL sequences.';
protected $signature = 'firefly-iii:fix-pgsql-sequences'; protected $signature = 'upgrade:600-pgsql-sequences';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -35,15 +35,15 @@ use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** /**
* Class TransferCurrenciesCorrections * Class UpgradeTransferCurrencies
*/ */
class TransferCurrenciesCorrections extends Command class UpgradeTransferCurrencies extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transfer_currencies'; public const string CONFIG_NAME = '480_transfer_currencies';
protected $description = 'Updates transfer currency information.'; protected $description = 'Updates transfer currency information.';
protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-transfer-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies; private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos; private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos; private JournalCLIRepositoryInterface $cliRepos;

View File

@@ -39,14 +39,14 @@ use Illuminate\Console\Command;
/** /**
* Class AccountCurrencies * Class AccountCurrencies
*/ */
class AccountCurrencies extends Command class UpgradesAccountCurrencies extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_account_currencies'; public const string CONFIG_NAME = '480_account_currencies';
protected $description = 'Give all accounts proper currency info.'; protected $description = 'Give all accounts proper currency info.';
protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-account-currencies {--F|force : Force the execution of this command.}';
private AccountRepositoryInterface $accountRepos; private AccountRepositoryInterface $accountRepos;
private int $count; private int $count;
private UserRepositoryInterface $userRepos; private UserRepositoryInterface $userRepos;

View File

@@ -29,10 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\AccountMeta; use FireflyIII\Models\AccountMeta;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesAccountMetaData extends Command
* Class RenameAccountMeta
*/
class RenameAccountMeta extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -40,7 +37,7 @@ class RenameAccountMeta extends Command
protected $description = 'Rename account meta-data to new format.'; protected $description = 'Rename account meta-data to new format.';
protected $signature = 'firefly-iii:rename-account-meta {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-account-meta {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -33,7 +33,7 @@ use Illuminate\Console\Command;
/** /**
* Class MigrateAttachments * Class MigrateAttachments
*/ */
class MigrateAttachments extends Command class UpgradesAttachments extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -41,7 +41,7 @@ class MigrateAttachments extends Command
protected $description = 'Migrates attachment meta-data.'; protected $description = 'Migrates attachment meta-data.';
protected $signature = 'firefly-iii:migrate-attachments {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-attachments {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -36,10 +36,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesBillsToRules extends Command
* Class MigrateToRules
*/
class MigrateToRules extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -47,7 +44,7 @@ class MigrateToRules extends Command
protected $description = 'Migrate bills to rules.'; protected $description = 'Migrate bills to rules.';
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-bills-to-rules {--F|force : Force the execution of this command.}';
private BillRepositoryInterface $billRepository; private BillRepositoryInterface $billRepository;
private int $count; private int $count;
private RuleGroupRepositoryInterface $ruleGroupRepository; private RuleGroupRepositoryInterface $ruleGroupRepository;

View File

@@ -28,10 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesBudgetLimitPeriods extends Command
* Class AppendBudgetLimitPeriods
*/
class AppendBudgetLimitPeriods extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -39,7 +36,7 @@ class AppendBudgetLimitPeriods extends Command
protected $description = 'Append budget limits with their (estimated) timeframe.'; protected $description = 'Append budget limits with their (estimated) timeframe.';
protected $signature = 'firefly-iii:budget-limit-periods {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:550-budget-limit-periods {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -31,10 +31,7 @@ use FireflyIII\Models\BudgetLimit;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesBudgetLimits extends Command
* Class BudgetLimitCurrency
*/
class BudgetLimitCurrency extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -42,7 +39,7 @@ class BudgetLimitCurrency extends Command
protected $description = 'Give budget limits a currency'; protected $description = 'Give budget limits a currency';
protected $signature = 'firefly-iii:bl-currency {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-budget-limit-currencies {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -31,16 +31,13 @@ use FireflyIII\Models\AccountType;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** class UpgradesCreditCardLiabilities extends Command
* Class CCLiabilities
*/
class CCLiabilities extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_cc_liabilities'; public const string CONFIG_NAME = '480_cc_liabilities';
protected $description = 'Convert old credit card liabilities.'; protected $description = 'Convert old credit card liabilities.';
protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-cc-liabilities {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -33,9 +33,9 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Class UpgradeCurrencyPreferences * Class UpgradesCurrencyPreferences
*/ */
class UpgradeCurrencyPreferences extends Command class UpgradesCurrencyPreferences extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -43,7 +43,7 @@ class UpgradeCurrencyPreferences extends Command
protected $description = 'Upgrade user currency preferences'; protected $description = 'Upgrade user currency preferences';
protected $signature = 'firefly-iii:upgrade-currency-preferences {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:610-currency-preferences {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -29,10 +29,7 @@ set_time_limit(0);
use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesDatabase extends Command
* Class UpgradeDatabase
*/
class UpgradeDatabase extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -46,33 +43,26 @@ class UpgradeDatabase extends Command
{ {
$this->callInitialCommands(); $this->callInitialCommands();
$commands = [ $commands = [
'firefly-iii:transaction-identifiers', 'upgrade:480-transaction-identifiers',
'firefly-iii:migrate-to-groups', 'upgrade:480-migrate-to-groups',
'firefly-iii:account-currencies', 'upgrade:480-account-currencies',
'firefly-iii:transfer-currencies', 'upgrade:480-transfer-currencies',
'firefly-iii:other-currencies', 'upgrade:480-currency-information',
'firefly-iii:migrate-notes', 'upgrade:480-notes',
'firefly-iii:migrate-attachments', 'upgrade:480-attachments',
'firefly-iii:bills-to-rules', 'upgrade:480-bills-to-rules',
'firefly-iii:bl-currency', 'upgrade:480-budget-limit-currencies',
'firefly-iii:cc-liabilities', 'upgrade:480-cc-liabilities',
'firefly-iii:back-to-journals', 'upgrade:480-journal-meta-data',
'firefly-iii:rename-account-meta', 'upgrade:480-account-meta',
'firefly-iii:migrate-recurrence-meta', 'upgrade:481-recurrence-meta',
'firefly-iii:migrate-tag-locations', 'upgrade:500-tag-locations',
'firefly-iii:migrate-recurrence-type', 'upgrade:550-recurrence-type',
'firefly-iii:upgrade-liabilities', 'upgrade:560-liabilities',
'firefly-iii:liabilities-600', 'upgrade:600-liabilities',
'firefly-iii:budget-limit-periods', 'upgrade:550-budget-limit-periods',
'firefly-iii:migrate-rule-actions', 'upgrade:600-rule-actions',
'firefly-iii:restore-oauth-keys', 'upgrade:610-account-balance',
'firefly-iii:correct-account-balance',
// also just in case, some integrity commands:
'firefly-iii:add-timezones-to-dates',
'firefly-iii:create-group-memberships',
'firefly-iii:upgrade-group-information',
'firefly-iii:upgrade-currency-preferences',
'firefly-iii:upgrade-multi-piggies',
'firefly-iii:correct-database', 'firefly-iii:correct-database',
]; ];
$args = []; $args = [];
@@ -94,7 +84,7 @@ class UpgradeDatabase extends Command
private function callInitialCommands(): void private function callInitialCommands(): void
{ {
$this->call('migrate', ['--seed' => true, '--force' => true, '--no-interaction' => true]); $this->call('migrate', ['--seed' => true, '--force' => true, '--no-interaction' => true]);
$this->call('firefly-iii:fix-pgsql-sequences'); $this->call('upgrade:600-pgsql-sequences');
$this->call('firefly-iii:decrypt-all'); $this->call('upgrade:480-decrypt-all');
} }
} }

View File

@@ -32,10 +32,7 @@ use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** class UpgradesJournalMetaData extends Command
* Class BackToJournals
*/
class BackToJournals extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -43,7 +40,7 @@ class BackToJournals extends Command
protected $description = 'Move meta data back to journals, not individual transactions.'; protected $description = 'Move meta data back to journals, not individual transactions.';
protected $signature = 'firefly-iii:back-to-journals {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-journal-meta-data {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.
@@ -71,7 +68,7 @@ class BackToJournals extends Command
private function isMigrated(): bool private function isMigrated(): bool
{ {
$configVar = app('fireflyconfig')->get(MigrateToGroups::CONFIG_NAME, false); $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
return (bool) $configVar->data; return (bool) $configVar->data;
} }

View File

@@ -29,10 +29,7 @@ use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta; use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesJournalNotes extends Command
* Class MigrateJournalNotes
*/
class MigrateJournalNotes extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -40,7 +37,7 @@ class MigrateJournalNotes extends Command
protected $description = 'Migrate notes for transaction journals.'; protected $description = 'Migrate notes for transaction journals.';
protected $signature = 'firefly-iii:migrate-notes {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-notes {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -34,16 +34,13 @@ use FireflyIII\Services\Internal\Support\CreditRecalculateService;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesLiabilities extends Command
* Class UpgradeLiabilities
*/
class UpgradeLiabilities extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '560_upgrade_liabilities'; public const string CONFIG_NAME = '560_upgrade_liabilities';
protected $description = 'Upgrade liabilities to new 5.6.0 structure.'; protected $description = 'Upgrade liabilities to new 5.6.0 structure.';
protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:560-liabilities {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -35,16 +35,13 @@ use FireflyIII\Services\Internal\Support\CreditRecalculateService;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/** class UpgradesLiabilitiesEight extends Command
* Class UpgradeLiabilitiesEight
*/
class UpgradeLiabilitiesEight extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '600_upgrade_liabilities'; public const string CONFIG_NAME = '600_upgrade_liabilities';
protected $description = 'Upgrade liabilities to new 6.0.0 structure.'; protected $description = 'Upgrade liabilities to new 6.0.0 structure.';
protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:600-liabilities {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.
@@ -201,32 +198,9 @@ class UpgradeLiabilitiesEight extends Command
/** @var TransactionJournal $journal */ /** @var TransactionJournal $journal */
foreach ($journals as $journal) { foreach ($journals as $journal) {
// $delete = false;
// /** @var Transaction $source */
// $source = $journal->transactions()->where('amount', '<', 0)->first();
// /** @var Transaction $dest */
// $dest = $journal->transactions()->where('amount', '>', 0)->first();
/**
* // if source is this liability and destination is expense, remove transaction.
* // if source is revenue and destination is liability, remove transaction.
* if ($source->account_id === $account->id && $dest->account->accountType->type === AccountType::EXPENSE) {
* $delete = true;
* }
* if ($dest->account_id === $account->id && $source->account->accountType->type === AccountType::REVENUE) {
* $delete = true;
* }
*
* // overruled. No transaction will be deleted, ever.
* // code is kept in place, so I can revisit my reasoning.
* $delete = false;
*/
// if ($delete) {
$service = app(TransactionGroupDestroyService::class); $service = app(TransactionGroupDestroyService::class);
$service->destroy($journal->transactionGroup); $service->destroy($journal->transactionGroup);
++$count; ++$count;
// }
} }
return $count; return $count;

View File

@@ -30,7 +30,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class UpgradeMultiPiggyBanks extends Command class UpgradesMultiPiggyBanks extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -38,7 +38,7 @@ class UpgradeMultiPiggyBanks extends Command
protected $description = 'Upgrade piggy banks so they can use multiple accounts.'; protected $description = 'Upgrade piggy banks so they can use multiple accounts.';
protected $signature = 'firefly-iii:upgrade-multi-piggies {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:620-piggy-banks {--F|force : Force the execution of this command.}';
private AccountRepositoryInterface $accountRepository; private AccountRepositoryInterface $accountRepository;
private PiggyBankRepositoryInterface $repository; private PiggyBankRepositoryInterface $repository;

View File

@@ -33,7 +33,7 @@ use Illuminate\Console\Command;
/** /**
* Class MigrateRecurrenceMeta * Class MigrateRecurrenceMeta
*/ */
class MigrateRecurrenceMeta extends Command class UpgradesRecurrenceMetaData extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -41,7 +41,7 @@ class MigrateRecurrenceMeta extends Command
protected $description = 'Migrate recurrence meta data'; protected $description = 'Migrate recurrence meta data';
protected $signature = 'firefly-iii:migrate-recurrence-meta {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:481-recurrence-meta {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -30,7 +30,7 @@ use Illuminate\Console\Command;
/** /**
* Class MigrateRecurrenceType * Class MigrateRecurrenceType
*/ */
class MigrateRecurrenceType extends Command class UpgradesRecurrenceType extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -38,7 +38,7 @@ class MigrateRecurrenceType extends Command
protected $description = 'Migrate transaction type of recurring transaction.'; protected $description = 'Migrate transaction type of recurring transaction.';
protected $signature = 'firefly-iii:migrate-recurrence-type {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:550-recurrence-type {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -27,7 +27,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleAction;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class MigrateRuleActions extends Command class UpgradesRuleActions extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -35,7 +35,7 @@ class MigrateRuleActions extends Command
protected $description = 'Migrate rule actions away from expression engine'; protected $description = 'Migrate rule actions away from expression engine';
protected $signature = 'firefly-iii:migrate-rule-actions {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:600-rule-actions {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -32,7 +32,7 @@ use Illuminate\Console\Command;
/** /**
* Class MigrateTagLocations * Class MigrateTagLocations
*/ */
class MigrateTagLocations extends Command class UpgradesTagLocations extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
@@ -40,7 +40,7 @@ class MigrateTagLocations extends Command
protected $description = 'Migrate tag locations.'; protected $description = 'Migrate tag locations.';
protected $signature = 'firefly-iii:migrate-tag-locations {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:500-tag-locations {--F|force : Force the execution of this command.}';
/** /**
* Execute the console command. * Execute the console command.

View File

@@ -36,20 +36,13 @@ use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** class UpgradesToGroups extends Command
* This command will take split transactions and migrate them to "transaction groups".
*
* It will only run once, but can be forced to run again.
*
* Class MigrateToGroups
*/
class MigrateToGroups extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_migrated_to_groups'; public const string CONFIG_NAME = '480_migrated_to_groups';
protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.'; protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}'; protected $signature = 'upgrade:480-migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
private JournalCLIRepositoryInterface $cliRepository; private JournalCLIRepositoryInterface $cliRepository;
private int $count; private int $count;
private TransactionGroupFactory $groupFactory; private TransactionGroupFactory $groupFactory;

View File

@@ -36,16 +36,14 @@ use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
/**
* Class OtherCurrenciesCorrections class UpgradesVariousCurrencyInformation extends Command
*/
class OtherCurrenciesCorrections extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_other_currencies'; public const string CONFIG_NAME = '480_other_currencies';
protected $description = 'Update all journal currency information.'; protected $description = 'Update all journal currency information.';
protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}'; protected $signature = 'upgrade:480-currency-information {--F|force : Force the execution of this command.}';
private array $accountCurrencies; private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos; private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos; private JournalCLIRepositoryInterface $cliRepos;

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Authentication; namespace FireflyIII\Support\Authentication;
use FireflyIII\Console\Commands\Integrity\CreateGroupMemberships; use FireflyIII\Console\Commands\Correction\CreateGroupMemberships;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Role; use FireflyIII\Models\Role;
use FireflyIII\User; use FireflyIII\User;

View File

@@ -1766,6 +1766,7 @@ return [
'updated_currency' => 'Currency :name updated', 'updated_currency' => 'Currency :name updated',
'ask_site_owner' => 'Please ask :owner to add, remove or edit currencies.', 'ask_site_owner' => 'Please ask :owner to add, remove or edit currencies.',
'currencies_intro' => 'Firefly III supports various currencies which you can set and enable here.', 'currencies_intro' => 'Firefly III supports various currencies which you can set and enable here.',
'currencies_switch_default' => 'If you have a large database, switching from one default currency to another may take a moment.',
'make_default_currency' => 'Make default', 'make_default_currency' => 'Make default',
'default_currency' => 'default', 'default_currency' => 'default',
'currency_is_disabled' => 'Disabled', 'currency_is_disabled' => 'Disabled',

View File

@@ -13,11 +13,10 @@
<a class="btn btn-success pull-right" href="{{ route('currencies.create') }}">{{ 'create_currency'|_ }}</a> <a class="btn btn-success pull-right" href="{{ route('currencies.create') }}">{{ 'create_currency'|_ }}</a>
</div> </div>
<div class="box-body"> <div class="box-body">
<p class="text-info"> <p>
{{ 'currencies_intro'|_ }} {{ 'currencies_intro'|_ }}
</p>
<p class="text-info">
{{ 'currencies_default_disabled'|_ }} {{ 'currencies_default_disabled'|_ }}
{{ 'currencies_switch_default'|_ }}
</p> </p>
{% if currencies|length > 0 %} {% if currencies|length > 0 %}
<div style="padding-left:8px;"> <div style="padding-left:8px;">