From a03e000af170b6b9aa6847eeeff6f082cd4b6161 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 12 Mar 2021 20:25:15 +0100 Subject: [PATCH] Small code cleanup. --- app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php | 8 ++++---- app/Services/Internal/Update/RecurrenceUpdateService.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php index 6c3aea75c3..3ddbff5b1c 100644 --- a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php @@ -121,7 +121,7 @@ class UpdateRequest extends FormRequest } if(array_key_exists('moment', $repetition)) { - $current['moment'] = $repetition['moment']; + $current['moment'] = (string)$repetition['moment']; } if(array_key_exists('skip', $repetition)) { @@ -195,9 +195,9 @@ class UpdateRequest extends FormRequest { $validator->after( function (Validator $validator) { - //$this->validateOneRecurrenceTransaction($validator); - //$this->validateOneRepetitionUpdate($validator); - //$this->validateRecurrenceRepetition($validator); + $this->validateOneRecurrenceTransaction($validator); + $this->validateOneRepetitionUpdate($validator); + $this->validateRecurrenceRepetition($validator); $this->validateRepetitionMoment($validator); $this->validateForeignCurrencyInformation($validator); $this->valUpdateAccountInfo($validator); diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index 714b6e0e99..71332053f1 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -100,6 +100,8 @@ class RecurrenceUpdateService // update each repetition or throw error yay $this->updateRepetitions($recurrence, $data['repetitions'] ?? []); } + // update all transactions: + // // update all transactions (and associated meta-data) // if (array_key_exists('transactions', $data)) { @@ -169,7 +171,8 @@ class RecurrenceUpdateService 'type' => 'repetition_type', 'moment' => 'repetition_moment', 'skip' => 'repetition_skip', - 'weekend' => 'weekend',]; + 'weekend' => 'weekend', + ]; foreach ($fields as $field => $column) { if (array_key_exists($field, $current)) { $match->$column = $current[$field];