mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-03 12:10:42 -06:00
Fixes for #233
This commit is contained in:
parent
e953f58c74
commit
21181d8d8e
@ -42,6 +42,7 @@ class AccountController extends Controller
|
||||
|
||||
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
||||
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
||||
Session::flash('preFilled', []);
|
||||
|
||||
// put previous url in session if not redirect from store (not "create another").
|
||||
if (session('accounts.create.fromStore') !== true) {
|
||||
|
@ -34,6 +34,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var array */
|
||||
private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber'];
|
||||
|
||||
/**
|
||||
* AttachmentRepository constructor.
|
||||
*
|
||||
@ -448,7 +451,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$this->updateMetadata($account, $data);
|
||||
$openingBalance = $this->openingBalanceTransaction($account);
|
||||
if ($data['openingBalance'] != 0) {
|
||||
if ($openingBalance) {
|
||||
if (!is_null($openingBalance->id)) {
|
||||
$this->updateInitialBalance($account, $openingBalance, $data);
|
||||
} else {
|
||||
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
||||
@ -570,8 +573,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
protected function storeMetadata(Account $account, array $data)
|
||||
{
|
||||
$validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
|
||||
foreach ($validFields as $field) {
|
||||
foreach ($this->validFields as $field) {
|
||||
if (isset($data[$field])) {
|
||||
$metaData = new AccountMeta(
|
||||
[
|
||||
@ -621,9 +623,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
protected function updateMetadata(Account $account, array $data)
|
||||
{
|
||||
$validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
|
||||
|
||||
foreach ($validFields as $field) {
|
||||
foreach ($this->validFields as $field) {
|
||||
$entry = $account->accountMeta()->where('name', $field)->first();
|
||||
|
||||
if (isset($data[$field])) {
|
||||
|
Loading…
Reference in New Issue
Block a user