mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
parent
f2cb675267
commit
66c13f35e7
@ -251,15 +251,13 @@ class UpgradeDatabase extends Command
|
||||
*/
|
||||
public function updateTransferCurrencies()
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$set = TransactionJournal
|
||||
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->where('transaction_types.type', TransactionType::TRANSFER)
|
||||
->get(['transaction_journals.*']);
|
||||
|
||||
$set->each(
|
||||
function (TransactionJournal $transfer) use ($repository) {
|
||||
function (TransactionJournal $transfer) {
|
||||
// select all "source" transactions:
|
||||
/** @var Collection $transactions */
|
||||
$transactions = $transfer->transactions()->where('amount', '<', 0)->get();
|
||||
|
@ -37,14 +37,13 @@ class TagFormRequest extends Request
|
||||
*/
|
||||
public function collectTagData(): array
|
||||
{
|
||||
$latitude = null;
|
||||
$longitude = null;
|
||||
$zoomLevel = null;
|
||||
if ($this->get('setTag') === 'true') {
|
||||
$latitude = $this->string('latitude');
|
||||
$longitude = $this->string('longitude');
|
||||
$zoomLevel = $this->integer('zoomLevel');
|
||||
} else {
|
||||
$latitude = null;
|
||||
$longitude = null;
|
||||
$zoomLevel = null;
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
@ -59,7 +59,8 @@ class RabobankDescription implements SpecificInterface
|
||||
);
|
||||
$row[6] = $alternateName;
|
||||
$row[10] = '';
|
||||
} else {
|
||||
}
|
||||
if (!(strlen($oppositeAccount) < 1 && strlen($oppositeName) < 1)) {
|
||||
Log::debug('Rabobank specific: either opposite account or name are filled.');
|
||||
}
|
||||
|
||||
|
@ -137,10 +137,9 @@ class Amount
|
||||
|
||||
if ($amount > 0) {
|
||||
return sprintf('<span class="text-success">%s</span>', $result);
|
||||
} else {
|
||||
if ($amount < 0) {
|
||||
return sprintf('<span class="text-danger">%s</span>', $result);
|
||||
}
|
||||
}
|
||||
if ($amount < 0) {
|
||||
return sprintf('<span class="text-danger">%s</span>', $result);
|
||||
}
|
||||
|
||||
return sprintf('<span style="color:#999">%s</span>', $result);
|
||||
@ -194,14 +193,13 @@ class Amount
|
||||
$cache->addProperty('getCurrencySymbol');
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
} else {
|
||||
$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
||||
|
||||
$cache->store($currency->symbol);
|
||||
|
||||
return $currency->symbol;
|
||||
}
|
||||
$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
||||
|
||||
$cache->store($currency->symbol);
|
||||
|
||||
return $currency->symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,14 +100,13 @@ class FireflyConfig
|
||||
Cache::forget('ff-config-' . $name);
|
||||
|
||||
return $item;
|
||||
} else {
|
||||
Log::debug('Exists already ', ['name' => $name]);
|
||||
$config->data = $value;
|
||||
$config->save();
|
||||
Cache::forget('ff-config-' . $name);
|
||||
|
||||
return $config;
|
||||
}
|
||||
Log::debug('Exists already ', ['name' => $name]);
|
||||
$config->data = $value;
|
||||
$config->save();
|
||||
Cache::forget('ff-config-' . $name);
|
||||
|
||||
return $config;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user