This commit is contained in:
James Cole 2016-11-24 19:15:16 +01:00
parent f029f7607b
commit 7ebb68e36c
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 4 additions and 2 deletions

View File

@ -160,6 +160,7 @@ class JournalFormRequest extends Request
*/ */
private function getFieldOrEmptyString(string $field): string private function getFieldOrEmptyString(string $field): string
{ {
return $this->get($field) ?? ''; $tring = $this->get($field) ?? ''
return trim($string);
} }
} }

View File

@ -90,11 +90,12 @@ class SplitJournalFormRequest extends Request
$return = []; $return = [];
// description is leading because it is one of the mandatory fields. // description is leading because it is one of the mandatory fields.
foreach ($this->get('description') as $index => $description) { foreach ($this->get('description') as $index => $description) {
$category = $this->get('category')[$index] ?? '';
$transaction = [ $transaction = [
'description' => $description, 'description' => $description,
'amount' => round($this->get('amount')[$index], 2), 'amount' => round($this->get('amount')[$index], 2),
'budget_id' => $this->get('budget_id')[$index] ? intval($this->get('budget_id')[$index]) : 0, '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]) 'source_account_id' => isset($this->get('source_account_id')[$index])
? intval($this->get('source_account_id')[$index]) ? intval($this->get('source_account_id')[$index])
: intval( : intval(