cleanup: Commands are a lot less verbal and report better on success / failue

This commit is contained in:
James Cole
2023-06-02 07:36:17 +02:00
parent 1e1497ff4e
commit dcf71c6fdf
60 changed files with 1108 additions and 1698 deletions

View File

@@ -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++;
}
}
}