diff --git a/.env.example b/.env.example index 37d4ca504d..da12344ec9 100644 --- a/.env.example +++ b/.env.example @@ -122,7 +122,7 @@ SESSION_DRIVER=file # If you use Docker or similar, you can set REDIS_HOST_FILE, REDIS_PASSWORD_FILE or # REDIS_PORT_FILE to set the value from a file instead of from an environment variable -# can be tcp, unix or http +# can be tcp or unix. http is not supported REDIS_SCHEME=tcp # use only when using 'unix' for REDIS_SCHEME. Leave empty otherwise. diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php index 3dbea108e6..a87843d0f6 100644 --- a/app/Console/Commands/Correction/EnableCurrencies.php +++ b/app/Console/Commands/Correction/EnableCurrencies.php @@ -71,7 +71,6 @@ class EnableCurrencies extends Command $found = [$defaultCurrency->id]; // get all meta entries - /** @var Collection $meta */ $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') ->where('accounts.user_group_id', $userGroup->id) ->where('account_meta.name', 'currency_id')->groupBy('data')->get(['data']) @@ -108,6 +107,12 @@ class EnableCurrencies extends Command $found[] = $entry->transaction_currency_id; } + // also get all currencies already enabled. + $alreadyEnabled = $userGroup->currencies()->get(['transaction_currencies.id'])->pluck('id')->toArray(); + foreach ($alreadyEnabled as $currencyId) { + $found[] = $currencyId; + } + $found = array_values(array_unique($found)); $found = array_values( array_filter(