mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Verify routine will check currency usage.
This commit is contained in:
@@ -25,6 +25,7 @@ namespace FireflyIII\Repositories\Currency;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\CurrencyExchangeRate;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
@@ -93,6 +94,14 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
// is being used in budget limits
|
||||
$budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count();
|
||||
if ($budgetLimit > 0) {
|
||||
Log::debug(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// is the default currency for the user or the system
|
||||
$defaultCode = app('preferences')->getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
||||
if ($currency->code === $defaultCode) {
|
||||
|
Reference in New Issue
Block a user