James Cole
2024-01-02 15:51:34 +01:00
parent 786b4c18a1
commit 4b9fd949ad
4 changed files with 56 additions and 40 deletions

View File

@@ -109,6 +109,12 @@ class CreateController extends Controller
'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : true, 'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : true,
] ]
); );
// issue #8321
$showNetWorth = true;
if ('liabilities' !== $objectType && 'asset' !== $objectType) {
$showNetWorth = false;
}
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
if (true !== session('accounts.create.fromStore')) { if (true !== session('accounts.create.fromStore')) {
@@ -119,7 +125,7 @@ class CreateController extends Controller
return view( return view(
'accounts.create', 'accounts.create',
compact('subTitleIcon', 'liabilityDirections', 'locations', 'objectType', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes') compact('subTitleIcon', 'liabilityDirections', 'showNetWorth', 'locations', 'objectType', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes')
); );
} }

View File

@@ -128,6 +128,12 @@ class EditController extends Controller
$includeNetWorth = $repository->getMetaValue($account, 'include_net_worth'); $includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
$includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth; $includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth;
// issue #8321
$showNetWorth = true;
if ('liabilities' !== $objectType && 'asset' !== $objectType) {
$showNetWorth = false;
}
// code to handle active-checkboxes // code to handle active-checkboxes
$hasOldInput = null !== $request->old('_token'); $hasOldInput = null !== $request->old('_token');
$virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance; $virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance;
@@ -155,7 +161,7 @@ class EditController extends Controller
$request->session()->flash('preFilled', $preFilled); $request->session()->flash('preFilled', $preFilled);
return view('accounts.edit', compact('account', 'currency', 'subTitle', 'subTitleIcon', 'locations', 'liabilityDirections', 'objectType', 'roles', 'preFilled', 'liabilityTypes', 'interestPeriods')); return view('accounts.edit', compact('account', 'currency', 'showNetWorth', 'subTitle', 'subTitleIcon', 'locations', 'liabilityDirections', 'objectType', 'roles', 'preFilled', 'liabilityTypes', 'interestPeriods'));
} }
/** /**

View File

@@ -57,7 +57,9 @@
{{ ExpandedForm.amountNoCurrency('virtual_balance') }} {{ ExpandedForm.amountNoCurrency('virtual_balance') }}
{% endif %} {% endif %}
{# only correct way to do active checkbox #} {# only correct way to do active checkbox #}
{% if showNetWorth %}
{{ ExpandedForm.checkbox('include_net_worth', 1) }} {{ ExpandedForm.checkbox('include_net_worth', 1) }}
{% endif %}
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }} {{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div> </div>

View File

@@ -67,7 +67,9 @@
{{ ExpandedForm.amountNoCurrency('virtual_balance',null) }} {{ ExpandedForm.amountNoCurrency('virtual_balance',null) }}
{% endif %} {% endif %}
{% if showNetWorth %}
{{ ExpandedForm.checkbox('include_net_worth', 1) }} {{ ExpandedForm.checkbox('include_net_worth', 1) }}
{% endif %}
{{ ExpandedForm.textarea('notes',preFilled.notes,{helpText: trans('firefly.field_supports_markdown')}) }} {{ ExpandedForm.textarea('notes',preFilled.notes,{helpText: trans('firefly.field_supports_markdown')}) }}
{# only correct way to do active checkbox #} {# only correct way to do active checkbox #}
{{ ExpandedForm.checkbox('active', 1) }} {{ ExpandedForm.checkbox('active', 1) }}