From 888d702f6edd70901d5615c4a240b5df5d574d95 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 10 Dec 2020 09:32:20 +0100 Subject: [PATCH] Fixed api call set stop_downtime --- pandora_console/include/functions_api.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 96b3bc8cfa..490e96576e 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -6360,6 +6360,14 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3) $date_time_stop = get_system_time(); + $sql = sprintf('SELECT date_to, type_execution, executed FROM tplanned_downtime WHERE id=%d', $id); + $data = db_get_row_sql($sql); + + if ($data['type_execution'] == 'periodically' && $data['executed'] == 1) { + returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running planned downtime cannot be stopped.')); + return; + } + $values = []; $values['date_to'] = $date_time_stop;