mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Fix #948
This commit is contained in:
@@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Requests\NewUserFormRequest;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use View;
|
||||
@@ -81,7 +82,7 @@ class NewUserController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function submit(NewUserFormRequest $request, AccountRepositoryInterface $repository)
|
||||
public function submit(NewUserFormRequest $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
|
||||
{
|
||||
// create normal asset account:
|
||||
$this->createAssetAccount($request, $repository);
|
||||
@@ -89,6 +90,16 @@ class NewUserController extends Controller
|
||||
// create savings account
|
||||
$this->createSavingsAccount($request, $repository);
|
||||
|
||||
// also store currency preference from input:
|
||||
$currency = $currencyRepository->find(intval($request->input('amount_currency_id_bank_balance')));
|
||||
|
||||
if(!is_null($currency->id)) {
|
||||
// store currency preference:
|
||||
Preferences::set('currencyPreference', $currency->code);
|
||||
Preferences::mark();
|
||||
}
|
||||
|
||||
|
||||
Session::flash('success', strval(trans('firefly.stored_new_accounts_new_user')));
|
||||
Preferences::mark();
|
||||
|
||||
@@ -137,7 +148,7 @@ class NewUserController extends Controller
|
||||
'accountRole' => 'savingAsset',
|
||||
'openingBalance' => round($request->input('savings_balance'), 12),
|
||||
'openingBalanceDate' => new Carbon,
|
||||
'currency_id' => intval($request->input('amount_currency_id_savings_balance')),
|
||||
'currency_id' => intval($request->input('amount_currency_id_bank_balance')),
|
||||
];
|
||||
$repository->store($savingsAccount);
|
||||
|
||||
|
Reference in New Issue
Block a user