mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code clean up.
This commit is contained in:
@@ -34,7 +34,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Storage;
|
||||
|
||||
|
||||
/**
|
||||
* Class CreateExport
|
||||
*
|
||||
|
@@ -58,7 +58,6 @@ class DecryptAttachment extends Command
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Console\Commands;
|
||||
|
||||
|
||||
use DB;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
@@ -93,8 +92,6 @@ class UpgradeDatabase extends Command
|
||||
$this->info('Firefly III database is up to date.');
|
||||
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +311,6 @@ class UpgradeDatabase extends Command
|
||||
$note->save();
|
||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
$meta->delete();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +330,10 @@ class UpgradeDatabase extends Command
|
||||
if (!(intval($currency->id) === intval($journal->transaction_currency_id))) {
|
||||
$this->line(
|
||||
sprintf(
|
||||
'Transfer #%d ("%s") has been updated to use %s instead of %s.', $journal->id, $journal->description, $currency->code,
|
||||
'Transfer #%d ("%s") has been updated to use %s instead of %s.',
|
||||
$journal->id,
|
||||
$journal->description,
|
||||
$currency->code,
|
||||
$journal->transactionCurrency->code
|
||||
)
|
||||
);
|
||||
@@ -423,8 +422,11 @@ class UpgradeDatabase extends Command
|
||||
if ($transaction->transaction_currency_id !== $currency->id && is_null($transaction->foreign_amount)) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.', $transaction->id,
|
||||
$transaction->transaction_currency_id, $currency->id, $transaction->amount
|
||||
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.',
|
||||
$transaction->id,
|
||||
$transaction->transaction_currency_id,
|
||||
$currency->id,
|
||||
$transaction->amount
|
||||
)
|
||||
);
|
||||
$transaction->transaction_currency_id = $currency->id;
|
||||
@@ -483,7 +485,6 @@ class UpgradeDatabase extends Command
|
||||
|
||||
// when both are zero, try to grab it from journal:
|
||||
if (is_null($opposing->foreign_amount) && is_null($transaction->foreign_amount)) {
|
||||
|
||||
$foreignAmount = $journal->getMeta('foreign_amount');
|
||||
if (is_null($foreignAmount)) {
|
||||
Log::debug(sprintf('Journal #%d has missing foreign currency data, forced to do 1:1 conversion :(.', $transaction->transaction_journal_id));
|
||||
@@ -497,7 +498,9 @@ class UpgradeDatabase extends Command
|
||||
$foreignPositive = app('steam')->positive(strval($foreignAmount));
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").', $transaction->transaction_journal_id, $foreignAmount
|
||||
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").',
|
||||
$transaction->transaction_journal_id,
|
||||
$foreignAmount
|
||||
)
|
||||
);
|
||||
$transaction->foreign_amount = bcmul($foreignPositive, '-1');
|
||||
|
@@ -59,7 +59,6 @@ class UpgradeFireflyInstructions extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
if ($this->argument('task') === 'update') {
|
||||
$this->updateInstructions();
|
||||
}
|
||||
@@ -109,12 +108,10 @@ class UpgradeFireflyInstructions extends Command
|
||||
if (substr($version, 0, $len) === $compare) {
|
||||
$text = $config[$compare];
|
||||
}
|
||||
|
||||
}
|
||||
$this->showLine();
|
||||
$this->boxed('');
|
||||
if (is_null($text)) {
|
||||
|
||||
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
|
||||
$this->boxedInfo('There are no extra installation instructions.');
|
||||
$this->boxed('Firefly III should be ready for use.');
|
||||
@@ -141,7 +138,6 @@ class UpgradeFireflyInstructions extends Command
|
||||
}
|
||||
$line .= '+';
|
||||
$this->line($line);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,12 +155,10 @@ class UpgradeFireflyInstructions extends Command
|
||||
if (substr($version, 0, $len) === $compare) {
|
||||
$text = $config[$compare];
|
||||
}
|
||||
|
||||
}
|
||||
$this->showLine();
|
||||
$this->boxed('');
|
||||
if (is_null($text)) {
|
||||
|
||||
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
|
||||
$this->boxedInfo('There are no extra upgrade instructions.');
|
||||
$this->boxed('Firefly III should be ready for use.');
|
||||
|
@@ -77,5 +77,4 @@ trait VerifiesAccessToken
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -96,7 +96,6 @@ class VerifyDatabase extends Command
|
||||
$this->repairPiggyBanks();
|
||||
$this->createLinkTypes();
|
||||
$this->createAccessTokens();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +207,10 @@ class VerifyDatabase extends Command
|
||||
foreach ($set as $entry) {
|
||||
$line = sprintf(
|
||||
'User #%d (%s) has budget #%d ("%s") which has no budget limits.',
|
||||
$entry->user_id, $entry->email, $entry->id, $entry->name
|
||||
$entry->user_id,
|
||||
$entry->email,
|
||||
$entry->id,
|
||||
$entry->name
|
||||
);
|
||||
$this->line($line);
|
||||
}
|
||||
@@ -327,7 +329,6 @@ class VerifyDatabase extends Command
|
||||
'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,7 +350,6 @@ class VerifyDatabase extends Command
|
||||
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
|
||||
$objName = $entry->name;
|
||||
try {
|
||||
$objName = Crypt::decrypt($objName);
|
||||
@@ -359,7 +359,11 @@ class VerifyDatabase extends Command
|
||||
|
||||
$line = sprintf(
|
||||
'User #%d (%s) has %s #%d ("%s") which has no transactions.',
|
||||
$entry->user_id, $entry->email, $name, $entry->id, $objName
|
||||
$entry->user_id,
|
||||
$entry->email,
|
||||
$name,
|
||||
$entry->id,
|
||||
$objName
|
||||
);
|
||||
$this->line($line);
|
||||
}
|
||||
@@ -419,11 +423,10 @@ class VerifyDatabase extends Command
|
||||
$this->error(
|
||||
sprintf(
|
||||
'Error: Transaction journal #%d is a %s, but has a budget. Edit it without changing anything, so the budget will be removed.',
|
||||
$entry->id, $entry->transactionType->type
|
||||
$entry->id,
|
||||
$entry->transactionType->type
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user