Fixed problems in scheduled downtime CLI

This commit is contained in:
samucarc 2018-09-25 13:33:10 +02:00
parent 010207e6ad
commit cc5104024d
2 changed files with 7 additions and 1 deletions

View File

@ -100,7 +100,7 @@ function returnError($typeError, $returnType = 'string') {
break;
default:
returnData("string",
array('type' => 'string', 'data' => __($typeError)));
array('type' => 'string', 'data' => __($returnType)));
break;
}
}

View File

@ -666,6 +666,7 @@ function planned_downtimes_stop ($downtime) {
function planned_downtimes_created ($values) {
global $config;
$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']);
@ -702,6 +703,11 @@ function planned_downtimes_created ($values) {
'message' => __('Not created. Error inserting data') . ". "
. __('The end day must be higher than the start day'));
}
else if (!$check_group && $values['id_group'] != 0) {
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('Group not exist'));
}
else {
if (trim(io_safe_output($values['name'])) != '') {
if (!$check) {