Small bug fixes.

This commit is contained in:
James Cole 2016-04-09 09:10:11 +02:00
parent 3962d9da92
commit 6f0f6e86a1
5 changed files with 12 additions and 10 deletions

View File

@ -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);

View File

@ -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'])) {

View File

@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
use Amount;
use Artisan;
use Carbon\Carbon;
use Config;
@ -120,11 +121,7 @@ class HomeController extends Controller
$sum = $repository->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) {

View File

@ -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.',

View File

@ -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.',