mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Various code cleanup.
This commit is contained in:
@@ -52,7 +52,7 @@ class FixFrontpageAccounts extends Command
|
|||||||
$users = User::get();
|
$users = User::get();
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$preference = Preferences::getForUser($user, 'frontPageAccounts');
|
$preference = app('preferences')->getForUser($user, 'frontPageAccounts');
|
||||||
if (null !== $preference) {
|
if (null !== $preference) {
|
||||||
$this->fixPreference($preference);
|
$this->fixPreference($preference);
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ class FixTransactionTypes extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$this->friendlyInfo('Corrected transaction type of %d transaction journals.', $count);
|
$this->friendlyInfo(sprintf('Corrected transaction type of %d transaction journals.', $count));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -26,8 +26,6 @@ namespace FireflyIII\Console\Commands\System;
|
|||||||
use FireflyIII\Support\System\GeneratesInstallationId;
|
use FireflyIII\Support\System\GeneratesInstallationId;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
use function FireflyIII\Console\Commands\str_starts_with;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UpgradeFireflyInstructions.
|
* Class UpgradeFireflyInstructions.
|
||||||
*
|
*
|
||||||
@@ -77,7 +75,7 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
$text = '';
|
$text = '';
|
||||||
foreach (array_keys($config) as $compare) {
|
foreach (array_keys($config) as $compare) {
|
||||||
// if string starts with:
|
// if string starts with:
|
||||||
if (\str_starts_with($version, $compare)) {
|
if (str_starts_with($version, $compare)) {
|
||||||
$text = $config[$compare];
|
$text = $config[$compare];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,7 +188,7 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
$text = '';
|
$text = '';
|
||||||
foreach (array_keys($config) as $compare) {
|
foreach (array_keys($config) as $compare) {
|
||||||
// if string starts with:
|
// if string starts with:
|
||||||
if (\str_starts_with($version, $compare)) {
|
if (str_starts_with($version, $compare)) {
|
||||||
$text = $config[$compare];
|
$text = $config[$compare];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ class VerifySecurityAlerts extends Command
|
|||||||
$version = config('firefly.version');
|
$version = config('firefly.version');
|
||||||
$disk = Storage::disk('resources');
|
$disk = Storage::disk('resources');
|
||||||
// Next line is ignored because it's a Laravel Facade.
|
// Next line is ignored because it's a Laravel Facade.
|
||||||
if (!$disk->has('alerts.json')) { // @phpstan-ignore-line
|
if (!$disk->has('alerts.json')) {
|
||||||
Log::debug('No alerts.json file present.');
|
Log::debug('No alerts.json file present.');
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -142,7 +142,7 @@ class UpgradeCurrencyPreferences extends Command
|
|||||||
// set the default currency for the user and for the group:
|
// set the default currency for the user and for the group:
|
||||||
$preference = $this->getPreference($user);
|
$preference = $this->getPreference($user);
|
||||||
$defaultCurrency = TransactionCurrency::where('code', $preference)->first();
|
$defaultCurrency = TransactionCurrency::where('code', $preference)->first();
|
||||||
if (null === $currency) {
|
if (null === $defaultCurrency) {
|
||||||
// get EUR
|
// get EUR
|
||||||
$defaultCurrency = TransactionCurrency::where('code', 'EUR')->first();
|
$defaultCurrency = TransactionCurrency::where('code', 'EUR')->first();
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event
|
|||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
private TransactionJournalLink $link; /// @phpstan-ignore-line PHPStan thinks this property is never read.
|
private TransactionJournalLink $link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DestroyedTransactionLink constructor.
|
* DestroyedTransactionLink constructor.
|
||||||
|
@@ -135,7 +135,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
$journals = array_reverse($journals, true);
|
$journals = array_reverse($journals, true);
|
||||||
$dayBeforeBalance = app('steam')->balance($account, $date);
|
$dayBeforeBalance = app('steam')->balance($account, $date);
|
||||||
$startBalance = $dayBeforeBalance;
|
$startBalance = $dayBeforeBalance;
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
|
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
|
||||||
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
||||||
|
|
||||||
foreach ($journals as $index => $journal) {
|
foreach ($journals as $index => $journal) {
|
||||||
|
@@ -127,7 +127,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
|||||||
{
|
{
|
||||||
$class = get_class($model);
|
$class = get_class($model);
|
||||||
// Line is ignored because all of Firefly III's Models have an id property.
|
// Line is ignored because all of Firefly III's Models have an id property.
|
||||||
Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id)); // @phpstan-ignore-line
|
Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
|
||||||
|
|
||||||
$uuid = Uuid::uuid4();
|
$uuid = Uuid::uuid4();
|
||||||
$basicMessage = [
|
$basicMessage = [
|
||||||
@@ -146,7 +146,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
|||||||
// Line is ignored because all of Firefly III's Models have an id property.
|
// Line is ignored because all of Firefly III's Models have an id property.
|
||||||
Log::error(
|
Log::error(
|
||||||
sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id)
|
sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id)
|
||||||
); // @phpstan-ignore-line
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case TransactionGroup::class:
|
case TransactionGroup::class:
|
||||||
|
@@ -47,7 +47,7 @@ class BillEventHandler
|
|||||||
|
|
||||||
$bill = $event->bill;
|
$bill = $event->bill;
|
||||||
/** @var bool $preference */
|
/** @var bool $preference */
|
||||||
$preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data;
|
$preference = app('preferences')->getForUser($bill->user, 'notification_bill_reminder', true)->data;
|
||||||
|
|
||||||
if (true === $preference) {
|
if (true === $preference) {
|
||||||
Log::debug('Bill reminder is true!');
|
Log::debug('Bill reminder is true!');
|
||||||
|
@@ -45,7 +45,7 @@ class RuleHandler
|
|||||||
{
|
{
|
||||||
$ruleAction = $event->ruleAction;
|
$ruleAction = $event->ruleAction;
|
||||||
$rule = $ruleAction->rule;
|
$rule = $ruleAction->rule;
|
||||||
$preference = Preferences::getForUser($rule->user, 'notification_rule_action_failures', true)->data;
|
$preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
|
||||||
if (false === $preference) {
|
if (false === $preference) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ class RuleHandler
|
|||||||
{
|
{
|
||||||
$ruleAction = $event->ruleAction;
|
$ruleAction = $event->ruleAction;
|
||||||
$rule = $ruleAction->rule;
|
$rule = $ruleAction->rule;
|
||||||
$preference = Preferences::getForUser($rule->user, 'notification_rule_action_failures', true)->data;
|
$preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
|
||||||
if (false === $preference) {
|
if (false === $preference) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user