mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-20 11:48:27 -06:00
Various fixes.
This commit is contained in:
parent
706b095f95
commit
693ff3cc66
0
.codeclimate.yml
Executable file → Normal file
0
.codeclimate.yml
Executable file → Normal file
@ -3,8 +3,8 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Helpers\Csv\Converter;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
||||
/**
|
||||
* Class AssetAccountIban
|
||||
@ -27,20 +27,29 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
if (strlen($this->value) > 0) {
|
||||
// find or create new account:
|
||||
$account = $this->findAccount();
|
||||
$accountType = AccountType::where('type', 'Asset account')->first();
|
||||
$account = $this->findAccount();
|
||||
|
||||
if (is_null($account)) {
|
||||
// create it if doesn't exist.
|
||||
$account = Account::firstOrCreateEncrypted( // See issue #180
|
||||
[
|
||||
'name' => $this->value,
|
||||
'iban' => $this->value,
|
||||
'user_id' => Auth::user()->id,
|
||||
'account_type_id' => $accountType->id,
|
||||
'active' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$accountData = [
|
||||
'name' => $this->value,
|
||||
'accountType' => 'asset',
|
||||
'virtualBalance' => 0,
|
||||
'virtualBalanceCurrency' => 1, // hard coded.
|
||||
'active' => true,
|
||||
'user' => Auth::user()->id,
|
||||
'iban' => null,
|
||||
'accountNumber' => $this->value,
|
||||
'accountRole' => null,
|
||||
'openingBalance' => 0,
|
||||
'openingBalanceDate' => new Carbon,
|
||||
'openingBalanceCurrency' => 1, // hard coded.
|
||||
|
||||
];
|
||||
|
||||
$account = $repository->store($accountData);
|
||||
}
|
||||
|
||||
return $account;
|
||||
|
@ -3,6 +3,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Helpers\Csv\Converter;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
||||
@ -26,7 +27,6 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
// find or create new account:
|
||||
$accountType = AccountType::where('type', 'Asset account')->first();
|
||||
$set = Auth::user()->accounts()->accountTypeIn(['Asset account', 'Default account'])->get();
|
||||
/** @var Account $entry */
|
||||
foreach ($set as $entry) {
|
||||
@ -36,15 +36,25 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
// create it if doesnt exist.
|
||||
$account = Account::firstOrCreateEncrypted( // See issue #180
|
||||
[
|
||||
'name' => $this->value,
|
||||
'iban' => '',
|
||||
'user_id' => Auth::user()->id,
|
||||
'account_type_id' => $accountType->id,
|
||||
'active' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$accountData = [
|
||||
'name' => $this->value,
|
||||
'accountType' => 'asset',
|
||||
'virtualBalance' => 0,
|
||||
'virtualBalanceCurrency' => 1, // hard coded.
|
||||
'active' => true,
|
||||
'user' => Auth::user()->id,
|
||||
'iban' => null,
|
||||
'accountNumber' => $this->value,
|
||||
'accountRole' => null,
|
||||
'openingBalance' => 0,
|
||||
'openingBalanceDate' => new Carbon,
|
||||
'openingBalanceCurrency' => 1, // hard coded.
|
||||
|
||||
];
|
||||
|
||||
$account = $repository->store($accountData);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
@ -20,15 +20,10 @@ class BudgetName extends BasicConverter implements ConverterInterface
|
||||
{
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
|
||||
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]); // see issue #180
|
||||
} else {
|
||||
$budget = Budget::firstOrCreateEncrypted( // See issue #180
|
||||
[
|
||||
'name' => $this->value,
|
||||
'user_id' => Auth::user()->id,
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$budget = $repository->store(['name' => $this->value, 'user' => Auth::user()->id]);
|
||||
}
|
||||
|
||||
return $budget;
|
||||
|
0
gulpfile.js
Executable file → Normal file
0
gulpfile.js
Executable file → Normal file
@ -15,7 +15,11 @@
|
||||
<a href="{{ route('accounts.show',income.id) }}" title="{{ income.name }}">{{ income.name }}</a>
|
||||
{% if income.count > 1 %}
|
||||
<br/>
|
||||
<small>{{ income.count }} {{ 'transactions'|_|lower }}</small>
|
||||
<small>
|
||||
{{ income.count }} {{ 'transactions'|_|lower }}
|
||||
<i class="fa fa-fw text-muted fa-info-circle"></i>
|
||||
</small>
|
||||
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ income.amount|formatAmount }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user