From 9eaacf30ad959e4dbf04934a859506db7afb5aeb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 May 2021 17:56:36 +0200 Subject: [PATCH] Fix #4739 --- app/Services/Internal/Update/AccountUpdateService.php | 9 +++++++++ resources/views/v2/budgets/{indexx.twig => index.twig} | 0 2 files changed, 9 insertions(+) rename resources/views/v2/budgets/{indexx.twig => index.twig} (100%) diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 09ca4f9833..74318bb1a1 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -136,6 +136,15 @@ class AccountUpdateService $account->account_type_id = $type->id; } } + // set liability, alternative method used in v1 layout: + + if ($this->isLiability($account) && array_key_exists('account_type_id', $data)) { + $type = AccountType::find((int)$data['account_type_id']); + + if (null !== $type && in_array($type->type, config('firefly.valid_liabilities'), true)) { + $account->account_type_id = $type->id; + } + } // update virtual balance (could be set to zero if empty string). if (array_key_exists('virtual_balance', $data) && null !== $data['virtual_balance']) { diff --git a/resources/views/v2/budgets/indexx.twig b/resources/views/v2/budgets/index.twig similarity index 100% rename from resources/views/v2/budgets/indexx.twig rename to resources/views/v2/budgets/index.twig