diff --git a/app/Helpers/Csv/Converter/AssetAccountIban.php b/app/Helpers/Csv/Converter/AssetAccountIban.php index 327d6e882e..19e0a8aec0 100644 --- a/app/Helpers/Csv/Converter/AssetAccountIban.php +++ b/app/Helpers/Csv/Converter/AssetAccountIban.php @@ -6,6 +6,7 @@ use Auth; use Carbon\Carbon; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Log; /** * Class AssetAccountIban @@ -26,6 +27,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface // is mapped? Then it's easy! if (isset($this->mapped[$this->index][$this->value])) { $account = $repository->find($this->mapped[$this->index][$this->value]); + Log::debug('Found mapped account for value "' . $this->value . '". It is account #' . $account->id); return $account; } @@ -36,10 +38,14 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface /** @var Account $entry */ foreach ($set as $entry) { if ($entry->iban == $this->value) { + Log::debug('Found an account with the same IBAN ("' . $this->value . '"). It is account #' . $entry->id); return $entry; } } + + Log::debug('Found no account with the same IBAN ("' . $this->value . '"), so will create a new one.'); + // create it if doesn't exist. $accountData = [ 'name' => $this->value, @@ -48,13 +54,12 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface 'virtualBalanceCurrency' => 1, // hard coded. 'active' => true, 'user' => Auth::user()->id, - 'iban' => null, + 'iban' => $this->value, 'accountNumber' => $this->value, 'accountRole' => null, 'openingBalance' => 0, 'openingBalanceDate' => new Carbon, 'openingBalanceCurrency' => 1, // hard coded. - ]; $account = $repository->store($accountData); diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php index 39cedcb6b0..02de9dff5c 100644 --- a/app/Helpers/Csv/Importer.php +++ b/app/Helpers/Csv/Importer.php @@ -144,11 +144,9 @@ class Importer } /** - * FIXME can return text - * * @return TransactionJournal|string */ - protected function createTransactionJournal(): TransactionJournal + protected function createTransactionJournal() { $date = $this->importData['date']; if (is_null($this->importData['date'])) { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5b76367ded..ee5a8a9147 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -1,5 +1,6 @@ sumOfEverything(); if (bccomp($sum, '0') !== 0) { - Session::flash( - 'error', 'Your transactions are unbalanced. This means a' - . ' withdrawal, deposit or transfer was not stored properly. ' - . 'Please check your accounts and transactions for errors (' . $sum . ').' - ); + Session::flash('error', strval(trans('firefly.unbalanced_error', ['amount' => Amount::format($sum,false)]))); } foreach ($accounts as $account) { diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index c90fc76182..3535a1b24f 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -32,6 +32,7 @@ return [ 'deleted_error' => 'These credentials do not match our records.', 'general_blocked_error' => 'Your account has been disabled, so you cannot login.', 'expired_error' => 'Your account has expired, and can no longer be used.', + 'unbalanced_error' => 'Your transactions are unbalanced. This means a withdrawal, deposit or transfer was not stored properly. Please check your accounts and transactions for errors (unbalanced amount :amount).', 'removed_amount' => 'Removed :amount', 'added_amount' => 'Added :amount', 'asset_account_role_help' => 'Any extra options resulting from your choice can be set later.', diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php index 52b6a21bd6..e8ffddbe88 100644 --- a/resources/lang/nl_NL/firefly.php +++ b/resources/lang/nl_NL/firefly.php @@ -32,6 +32,7 @@ return [ 'deleted_error' => 'Deze gegevens zijn niet correct.', 'general_blocked_error' => 'Je account is uitgeschakeld, je kan helaas niet inloggen.', 'expired_error' => 'Je account is verlopen, je kan helaas niet inloggen.', + 'unbalanced_error' => 'Je kasboek is uit balans. Dat betekent dat er een uitgave, inkomsten of overschrijving niet netjes is opgeslagen. Kijk goed of je ergens een fout kan vinden (afwijkend bedrag: :amount).', 'removed_amount' => ':amount weggehaald', 'added_amount' => ':amount toegevoegd', 'asset_account_role_help' => 'Voorkeuren die voortkomen uit je keuze hier kan je later aangeven.',