mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Clean up some code.
This commit is contained in:
@@ -61,7 +61,7 @@ class MoveTransactionsRequest extends FormRequest
|
||||
* Configure the validator instance with special rules for after the basic validation rules.
|
||||
*
|
||||
* @param Validator $validator
|
||||
* TODO duplicate code.
|
||||
* TODO duplicate code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@@ -80,10 +80,10 @@ class StoreRequest extends FormRequest
|
||||
// append Location information.
|
||||
$data = $this->appendLocationData($data, null);
|
||||
|
||||
if ('liability' === $data['account_type'] || 'liabilities' === $data['account_type']) {
|
||||
if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
|
||||
$data['opening_balance'] = bcmul($this->string('liability_amount'), '-1');
|
||||
$data['opening_balance_date'] = $this->date('liability_start_date');
|
||||
$data['account_type'] = $this->string('liability_type');
|
||||
$data['account_type_name'] = $this->string('liability_type');
|
||||
$data['account_type_id'] = null;
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ class UpdateRequest extends FormRequest
|
||||
'name' => ['name', 'string'],
|
||||
'active' => ['active', 'boolean'],
|
||||
'include_net_worth' => ['include_net_worth', 'boolean'],
|
||||
'account_type' => ['type', 'string'],
|
||||
'account_type_name' => ['type', 'string'],
|
||||
'virtual_balance' => ['virtual_balance', 'string'],
|
||||
'iban' => ['iban', 'string'],
|
||||
'BIC' => ['bic', 'string'],
|
||||
@@ -72,10 +72,10 @@ class UpdateRequest extends FormRequest
|
||||
$data = $this->getAllData($fields);
|
||||
$data = $this->appendLocationData($data, null);
|
||||
|
||||
if (array_key_exists('account_type', $data) && 'liability' === $data['account_type']) {
|
||||
if (array_key_exists('account_type_name', $data) && 'liability' === $data['account_type_name']) {
|
||||
$data['opening_balance'] = bcmul($this->nullableString('liability_amount'), '-1');
|
||||
$data['opening_balance_date'] = $this->date('liability_start_date');
|
||||
$data['account_type'] = $this->nullableString('liability_type');
|
||||
$data['account_type_name'] = $this->nullableString('liability_type');
|
||||
$data['account_type_id'] = null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user