diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.php index 9894dda5c3..7562946ac8 100644 --- a/app/lib/FireflyIII/Database/Account/Account.php +++ b/app/lib/FireflyIII/Database/Account/Account.php @@ -105,10 +105,11 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte /** @var \FireflyIII\Database\TransactionType\TransactionType $typeRepository */ $typeRepository = \App::make('FireflyIII\Database\TransactionType\TransactionType'); $type = $typeRepository->findByWhat('opening'); - $currency = \Amount::getDefaultCurrency(); + $currency = $journals->getJournalCurrencyById(intval($data['balance_currency_id'])); + //$currency = \Amount::getDefaultCurrency(); $opening = ['transaction_type_id' => $type->id, 'transaction_currency_id' => $currency->id, 'amount' => $balance, 'from' => $fromAccount, - 'completed' => 0, 'currency' => 'EUR', 'what' => 'opening', 'to' => $toAccount, 'date' => $date, + 'completed' => 0, 'what' => 'opening', 'to' => $toAccount, 'date' => $date, 'description' => 'Opening balance for new account ' . $account->name,]; $validation = $journals->validate($opening); diff --git a/app/lib/FireflyIII/Form/Form.php b/app/lib/FireflyIII/Form/Form.php index c6b76bd38a..59a28f7828 100644 --- a/app/lib/FireflyIII/Form/Form.php +++ b/app/lib/FireflyIII/Form/Form.php @@ -140,7 +140,7 @@ class Form $classes = self::getHolderClasses($name); $value = self::fillFieldValue($name, $value); $options['step'] = 'any'; - $defaultCurrency = \Amount::getDefaultCurrency(); + $defaultCurrency = isset($options['currency']) ? $options['currency'] : \Amount::getDefaultCurrency(); $currencies = \TransactionCurrency::orderBy('code','ASC')->get(); $html = \View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); return $html; diff --git a/app/views/accounts/edit.blade.php b/app/views/accounts/edit.blade.php index 547068fae8..45737070a9 100644 --- a/app/views/accounts/edit.blade.php +++ b/app/views/accounts/edit.blade.php @@ -26,7 +26,7 @@