mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Various bugfixes and code clean up.
This commit is contained in:
@@ -47,6 +47,7 @@ class ExportFormRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
/** @var Carbon $sessionFirst */
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::create()->addDay()->format('Y-m-d');
|
||||
|
||||
@@ -190,7 +190,7 @@ class RecurrenceFormRequest extends Request
|
||||
$rules['repetitions'] = 'required|numeric|between:0,254';
|
||||
}
|
||||
// if foreign amount, currency must be different.
|
||||
if (0.0 !== $this->float('foreign_amount')) {
|
||||
if (null !== $this->float('foreign_amount')) {
|
||||
$rules['foreign_currency_id'] = 'exists:transaction_currencies,id|different:transaction_currency_id';
|
||||
}
|
||||
|
||||
|
||||
@@ -56,11 +56,15 @@ class Request extends FormRequest
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return float
|
||||
* @return float|null
|
||||
*/
|
||||
public function float(string $field): float
|
||||
public function float(string $field): ?float
|
||||
{
|
||||
return (float)$this->get($field);
|
||||
$res = $this->get($field);
|
||||
if(null === $res) {
|
||||
return null;
|
||||
}
|
||||
return (float)$res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,7 @@ class SelectTransactionsRequest extends Request
|
||||
public function rules(): array
|
||||
{
|
||||
// fixed
|
||||
/** @var Carbon $sessionFirst */
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::create()->addDay()->format('Y-m-d');
|
||||
|
||||
Reference in New Issue
Block a user