From 896ddd1a15e83f7c70640d561def7fb30410b463 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 5 Jul 2023 14:07:11 +0200 Subject: [PATCH] #11692 the option to stop Scheduled Downtime is enabled for the Periodically execution type --- .../godmode/agentes/planned_downtime.list.php | 2 +- .../include/functions_planned_downtimes.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 4669b98858..a9a65bc834 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -835,7 +835,7 @@ if ($downtimes === false && $filter_performed === false) { // If user have writting permissions. if (in_array($downtime['id_group'], $groupsAD) === true) { // Stop button. - if ($downtime['type_execution'] === 'once' + if (($downtime['type_execution'] === 'once' || $downtime['type_execution'] === 'periodically') && (int) $downtime['executed'] === 1 ) { if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 06cda4955e..d9925a24b2 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -566,7 +566,17 @@ function planned_downtimes_stop($downtime) break; case 'periodically': - return false; + $values = [ + 'executed' => 0, + 'date_to' => time(), + ]; + + $result = db_process_sql_update( + 'tplanned_downtime', + $values, + ['id' => $id_downtime] + ); + break; default: // Nothing to do.