mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
cleanup: Commands are a lot less verbal and report better on success / failue
This commit is contained in:
@@ -34,18 +34,9 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class FixIbans extends Command
|
||||
{
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Removes spaces from IBANs';
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'firefly-iii:fix-ibans';
|
||||
protected $signature = 'firefly-iii:fix-ibans';
|
||||
private int $count = 0;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
@@ -57,6 +48,9 @@ class FixIbans extends Command
|
||||
$accounts = Account::whereNotNull('iban')->get();
|
||||
$this->filterIbans($accounts);
|
||||
$this->countAndCorrectIbans($accounts);
|
||||
if (0 === $this->count) {
|
||||
$this->info('Correct: All IBANs are valid.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -99,6 +93,7 @@ class FixIbans extends Command
|
||||
);
|
||||
$account->iban = null;
|
||||
$account->save();
|
||||
$this->count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +119,7 @@ class FixIbans extends Command
|
||||
$account->iban = $iban;
|
||||
$account->save();
|
||||
$this->line(sprintf('Removed spaces from IBAN of account #%d', $account->id));
|
||||
$this->count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user