Merge branch '4748-API-call-set-planned_downtimes_created' into 'develop'

Added control for same-day and different hours planned downtimes

See merge request artica/pandorafms!2788
This commit is contained in:
Daniel Rodriguez 2019-10-08 11:37:10 +02:00
commit bc2e40d0a3
1 changed files with 3 additions and 1 deletions

View File

@ -748,7 +748,9 @@ function planned_downtimes_created($values)
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'),
];
} else if ($values['type_execution'] == 'once' && $values['date_from'] >= $values['date_to']) {
} else if ($values['type_execution'] == 'once' && ($values['date_from'] > $values['date_to'])
|| (($values['date_from'] == $values['date_to']) && ($values['periodically_time_from'] >= $values['periodically_time_to']))
) {
return [
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'),