From 7ebb68e36cb1389325ccf7f950da6459f71e5edb Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 24 Nov 2016 19:15:16 +0100 Subject: [PATCH] This fixes #419 --- app/Http/Requests/JournalFormRequest.php | 3 ++- app/Http/Requests/SplitJournalFormRequest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index df01440f4a..a14471c23a 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -160,6 +160,7 @@ class JournalFormRequest extends Request */ private function getFieldOrEmptyString(string $field): string { - return $this->get($field) ?? ''; + $tring = $this->get($field) ?? '' + return trim($string); } } diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php index ea246fc2d1..539838c794 100644 --- a/app/Http/Requests/SplitJournalFormRequest.php +++ b/app/Http/Requests/SplitJournalFormRequest.php @@ -90,11 +90,12 @@ class SplitJournalFormRequest extends Request $return = []; // description is leading because it is one of the mandatory fields. foreach ($this->get('description') as $index => $description) { + $category = $this->get('category')[$index] ?? ''; $transaction = [ 'description' => $description, 'amount' => round($this->get('amount')[$index], 2), 'budget_id' => $this->get('budget_id')[$index] ? intval($this->get('budget_id')[$index]) : 0, - 'category' => $this->get('category')[$index] ?? '', + 'category' => trim($category), 'source_account_id' => isset($this->get('source_account_id')[$index]) ? intval($this->get('source_account_id')[$index]) : intval(