Merge branch 'ent-4384-cli-stop-downtime-bug' into 'develop'

fixed fixed error on stop_downtime

See merge request artica/pandorafms!2717
This commit is contained in:
Alejandro Fraguas 2019-11-05 11:03:02 +01:00
commit b409dde9c0

View File

@ -5895,9 +5895,16 @@ sub cli_stop_downtime () {
exist_check($downtime_id,'planned downtime',$downtime_id);
my $current_time = time;
my $downtime_date_to = get_db_value ($dbh, 'SELECT date_to FROM tplanned_downtime WHERE id=?', $downtime_id);
if($current_time >= $downtime_date_to) {
my $data = get_db_single_row ($dbh, 'SELECT date_to, type_execution, executed FROM tplanned_downtime WHERE id=?', $downtime_id);
if( $data->{'type_execution'} eq 'periodically' && $data->{'executed'} == 1){
print_log "[ERROR] Planned_downtime '$downtime_name' cannot be stopped.\n";
print_log "[INFO] Periodical and running planned downtime cannot be stopped.\n\n";
exit;
}
if($current_time >= $data->{'date_to'}) {
print_log "[INFO] Planned_downtime '$downtime_name' is already stopped\n\n";
exit;
}