mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-26 16:26:35 -06:00
This commit is contained in:
parent
e7a1ad23f4
commit
3cfaa5aa03
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user