1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for validation

This commit is contained in:
David Bomba 2023-02-20 16:47:30 +11:00
parent e3dfcb06b4
commit 60868003c7
2 changed files with 7 additions and 2 deletions

View File

@ -41,8 +41,8 @@ class StoreSchedulerRequest extends Request
'parameters' => 'bail|array',
'parameters.clients' => ['bail','sometimes', 'array', new ValidClientIds()],
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,custom',
'parameters.start_date' => ['bail', 'sometimes', 'date', 'required_if:parameters.date_rate,custom'],
'parameters.end_date' => ['bail', 'sometimes', 'date', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
'parameters.start_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom'],
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
];
return $rules;

View File

@ -12,6 +12,7 @@ namespace App\Http\Requests\TaskScheduler;
use App\Http\Requests\Request;
use Illuminate\Validation\Rule;
use App\Http\ValidationRules\Scheduler\ValidClientIds;
class UpdateSchedulerRequest extends Request
{
@ -35,6 +36,10 @@ class UpdateSchedulerRequest extends Request
'next_run_client' => 'bail|sometimes|date:Y-m-d',
'template' => 'bail|required|string',
'parameters' => 'bail|array',
'parameters.clients' => ['bail','sometimes', 'array', new ValidClientIds()],
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,custom',
'parameters.start_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom'],
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
];
return $rules;