Former-commit-id: 0ea7cf8437935c77098b1e408a723ac3de4d973c
This commit is contained in:
Alejandro Gallardo Escobar 2019-02-19 14:52:14 +01:00
parent 68afc9289d
commit 2573e40538
1 changed files with 5 additions and 7 deletions

View File

@ -725,8 +725,6 @@ function planned_downtimes_created($values)
$check_group = (bool) db_get_value('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']);
$check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $values['name']);
$datetime_from = strtotime($values['once_date_from'].' '.$values['once_time_from']);
$datetime_to = strtotime($values['once_date_to'].' '.$values['once_time_to']);
$now = time();
$result = false;
@ -735,16 +733,16 @@ function planned_downtimes_created($values)
'return' => false,
'message' => __('Not created. Error inserting data. Start time must be higher than the current time'),
];
} else if ($values['type_execution'] == 'once' && !$config['past_planned_downtimes'] && $values['date_to'] <= $now) {
return [
'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']) {
return [
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'),
];
} else if ($values['type_execution'] == 'once' && $values['date_to'] <= $now) {
return [
'return' => false,
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'),
];
} else if ($values['type_execution'] == 'periodically'
&& (($values['type_periodicity'] == 'weekly' && $values['periodically_time_from'] >= $values['periodically_time_to'])
|| ($values['type_periodicity'] == 'monthly' && $values['periodically_day_from'] == $values['periodically_day_to'] && $values['periodically_time_from'] >= $values['periodically_time_to']))