mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 19:49:54 +00:00
Fix ibans
This commit is contained in:
@@ -37,9 +37,9 @@ class FixIbans extends Command
|
|||||||
{
|
{
|
||||||
use ShowsFriendlyMessages;
|
use ShowsFriendlyMessages;
|
||||||
|
|
||||||
protected $description = 'Removes spaces from IBANs';
|
protected $description = 'Removes spaces from IBANs';
|
||||||
protected $signature = 'firefly-iii:fix-ibans';
|
protected $signature = 'firefly-iii:fix-ibans';
|
||||||
private int $count = 0;
|
private int $count = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
@@ -60,15 +60,13 @@ class FixIbans extends Command
|
|||||||
{
|
{
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$iban = $account->iban;
|
$iban = (string) $account->iban;
|
||||||
if (str_contains($iban, ' ')) {
|
$newIban = app('steam')->filterSpaces($iban);
|
||||||
$iban = app('steam')->filterSpaces((string)$account->iban);
|
if ('' !== $iban && $iban !== $newIban) {
|
||||||
if ('' !== $iban) {
|
$account->iban = $newIban;
|
||||||
$account->iban = $iban;
|
$account->save();
|
||||||
$account->save();
|
$this->friendlyInfo(sprintf('Removed spaces from IBAN of account #%d', $account->id));
|
||||||
$this->friendlyInfo(sprintf('Removed spaces from IBAN of account #%d', $account->id));
|
++$this->count;
|
||||||
++$this->count;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,13 +77,13 @@ class FixIbans extends Command
|
|||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$userId = $account->user_id;
|
$userId = $account->user_id;
|
||||||
$set[$userId] ??= [];
|
$set[$userId] ??= [];
|
||||||
$iban = (string)$account->iban;
|
$iban = (string) $account->iban;
|
||||||
if ('' === $iban) {
|
if ('' === $iban) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$type = $account->accountType->type;
|
$type = $account->accountType->type;
|
||||||
if (in_array($type, [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true)) {
|
if (in_array($type, [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true)) {
|
||||||
$type = 'liabilities';
|
$type = 'liabilities';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user