Replace references to hard coded config with variables.

This commit is contained in:
James Cole
2025-12-20 07:00:53 +01:00
parent 0f0cdb8e96
commit 8e729d6bbf
36 changed files with 51 additions and 50 deletions

View File

@@ -62,7 +62,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
*/
public function handle(): int
{
if (false === config('cer.enabled')) {
if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) {
$this->friendlyInfo('This command will not run because currency exchange rates are disabled.');
return 0;

View File

@@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Models\AccountBalanceCalculator;
use Illuminate\Console\Command;
@@ -60,7 +61,7 @@ class CorrectsUnevenAmount extends Command
$this->fixUnevenAmounts();
$this->matchCurrencies();
if (true === config('firefly.feature_flags.running_balance_column')) {
if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
$this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.');
AccountBalanceCalculator::recalculateAll(false);
$this->friendlyInfo('Done recalculating transaction running balance columns.');

View File

@@ -52,7 +52,7 @@ class RecalculatesRunningBalance extends Command
*/
public function handle(): int
{
if (true === config('firefly.feature_flags.running_balance_column')) {
if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
$this->correctBalanceAmounts($this->option('force'));
$this->friendlyInfo('Done recalculating account balances.');

View File

@@ -72,7 +72,7 @@ class Cron extends Command
$force = (bool) $this->option('force'); // @phpstan-ignore-line
// Fire exchange rates cron job.
if (true === config('cer.download_enabled') && ($doAll || $this->option('download-cer'))) {
if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) {
try {
$this->exchangeRatesCronJob($force, $date);
} catch (FireflyException $e) {

View File

@@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command
return 0;
}
if (true === config('firefly.feature_flags.running_balance_column')) {
if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
$this->markAsExecuted();
$this->correctBalanceAmounts();