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