Add empty value check (#1529)

This commit is contained in:
Alex Tselegidis 2024-05-21 15:22:40 +02:00
parent 3f39861e4a
commit 7713f3ffa6

View file

@ -524,6 +524,13 @@ class Providers_model extends EA_Model
array $working_plan_exception = null, array $working_plan_exception = null,
): void { ): void {
// Validate the working plan exception data. // Validate the working plan exception data.
if (empty($working_plan_exception['start']) || empty($working_plan_exception['end'])) {
throw new InvalidArgumentException(
'Empty start and/or end time provided: ' . json_encode($working_plan_exception),
);
}
$start = date('H:i', strtotime($working_plan_exception['start'])); $start = date('H:i', strtotime($working_plan_exception['start']));
$end = date('H:i', strtotime($working_plan_exception['end'])); $end = date('H:i', strtotime($working_plan_exception['end']));