Code cleanup and realign.

This commit is contained in:
James Cole
2018-08-06 19:14:30 +02:00
parent f7eef25fed
commit 5908c0ce8c
188 changed files with 1019 additions and 1031 deletions

View File

@@ -70,7 +70,7 @@ class AccountFormRequest extends Request
// if the account type is "liabilities" there are actually four types of liability
// that could have been selected.
if ($data['accountType'] === 'liabilities') {
if ('liabilities' === $data['accountType']) {
$data['accountType'] = null;
$data['account_type_id'] = $this->integer('liability_type_id');
// also reverse the opening balance:

View File

@@ -270,7 +270,7 @@ class JournalFormRequest extends Request
*/
private function validateDeposit(Validator $validator): void
{
$data = $validator->getData();
$data = $validator->getData();
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
$accountCurrency = (int)($data['destination_account_currency'] ?? 0);
$nativeAmount = (string)($data['native_amount'] ?? '');
@@ -290,7 +290,7 @@ class JournalFormRequest extends Request
*/
private function validateTransfer(Validator $validator): void
{
$data = $validator->getData();
$data = $validator->getData();
$sourceCurrency = (int)($data['source_account_currency'] ?? 0);
$destinationCurrency = (int)($data['destination_account_currency'] ?? 0);
$sourceAmount = (string)($data['source_amount'] ?? '');

View File

@@ -150,7 +150,7 @@ class RecurrenceFormRequest extends Request
{
$today = new Carbon;
$tomorrow = Carbon::now()->addDay();
$rules = [
$rules = [
// mandatory info for recurrence.
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'first_date' => 'required|date|after:' . $today->format('Y-m-d'),

View File

@@ -61,9 +61,10 @@ class Request extends FormRequest
public function float(string $field): ?float
{
$res = $this->get($field);
if(null === $res) {
if (null === $res) {
return null;
}
return (float)$res;
}

View File

@@ -61,6 +61,7 @@ class RuleFormRequest extends Request
'rule_triggers' => $this->getRuleTriggerData(),
'rule_actions' => $this->getRuleActionData(),
];
return $data;
}
@@ -109,8 +110,8 @@ class RuleFormRequest extends Request
*/
private function getRuleActionData(): array
{
$return = [];
$actionData= $this->get('rule_actions');
$return = [];
$actionData = $this->get('rule_actions');
if (\is_array($actionData)) {
foreach ($actionData as $action) {
$stopProcessing = $action['stop_processing'] ?? '0';