Can no longer set currency of expense / revenue accounts.

This commit is contained in:
James Cole
2022-10-23 14:46:26 +02:00
parent a91f6fbfaf
commit abdb717b37
4 changed files with 35 additions and 2 deletions

View File

@@ -115,6 +115,16 @@ trait AccountServiceTrait
$fields = $this->validAssetFields;
}
// remove currency_id if necessary.
$type = $account->accountType->type;
$list = config('firefly.valid_currency_account_types');
if(!in_array($type, $list, true)) {
$pos = array_search('currency_id', $fields);
if ($pos !== false) {
unset($fields[$pos]);
}
}
// the account role may not be set in the data but we may have it already:
if (!array_key_exists('account_role', $data)) {
$data['account_role'] = null;