James Cole 2023-01-16 06:39:16 +01:00
parent e7a1ad23f4
commit 3cfaa5aa03
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 1 additions and 17 deletions

View File

@ -83,8 +83,6 @@ class StoreRequest extends FormRequest
$data = $this->appendLocationData($data, null);
if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
$data['opening_balance'] = app('steam')->negative($this->convertString('liability_amount'));
$data['opening_balance_date'] = $this->getCarbonDate('liability_start_date');
$data['account_type_name'] = $this->convertString('liability_type');
$data['liability_direction'] = $this->convertString('liability_direction');
$data['account_type_id'] = null;

View File

@ -76,22 +76,8 @@ class UpdateRequest extends FormRequest
'liability_amount' => ['liability_amount', 'convertString'],
'liability_start_date' => ['liability_start_date', 'date'],
];
/** @var Account $account */
$account = $this->route()->parameter('account');
$data = $this->getAllData($fields);
$data = $this->appendLocationData($data, null);
$valid = config('firefly.valid_liabilities');
if (array_key_exists('liability_amount', $data) && in_array($account->accountType->type, $valid, true)) {
$data['opening_balance'] = app('steam')->negative($data['liability_amount']);
Log::debug(sprintf('Opening balance for liability is "%s".', $data['opening_balance']));
}
if (array_key_exists('liability_start_date', $data) && in_array($account->accountType->type, $valid, true)) {
$data['opening_balance_date'] = $data['liability_start_date'];
Log::debug(sprintf('Opening balance date for liability is "%s".', $data['opening_balance_date']));
}
return $data;
return $this->appendLocationData($data, null);
}
/**