mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code reshuffelling.
This commit is contained in:
@@ -57,6 +57,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
public function countJournals(TransactionCurrency $currency): int
|
||||
{
|
||||
$count = $currency->transactions()->whereNull('deleted_at')->count() + $currency->transactionJournals()->whereNull('deleted_at')->count();
|
||||
|
||||
// also count foreign:
|
||||
return $count + Transaction::where('foreign_currency_id', $currency->id)->count();
|
||||
}
|
||||
@@ -452,9 +453,17 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isFallbackCurrency(TransactionCurrency $currency): bool
|
||||
{
|
||||
return $currency->code === config('firefly.default_currency', 'EUR');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
* @param int $limit
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
@@ -508,12 +517,4 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
|
||||
return $service->update($currency, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isFallbackCurrency(TransactionCurrency $currency): bool
|
||||
{
|
||||
return $currency->code === config('firefly.default_currency', 'EUR');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,6 @@ use Illuminate\Support\Collection;
|
||||
interface CurrencyRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFallbackCurrency(TransactionCurrency $currency): bool;
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
@@ -223,6 +216,13 @@ interface CurrencyRepositoryInterface
|
||||
*/
|
||||
public function getExchangeRates(TransactionCurrency $currency): Collection;
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFallbackCurrency(TransactionCurrency $currency): bool;
|
||||
|
||||
/**
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
@@ -238,8 +238,9 @@ interface CurrencyRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data): TransactionCurrency;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user