Merge remote-tracking branch 'origin/develop' into ent-11471-integracion-pandora-integria
Conflicts: pandora_console/extras/delete_files/delete_files.txt
This commit is contained in:
commit
f0d78a44d1
|
@ -1703,6 +1703,11 @@ enterprise/meta/monitoring/wizard/wizard.module.web.php
|
|||
enterprise/meta/monitoring/wizard/wizard.php
|
||||
enterprise/meta/monitoring/wizard/wizard.update_agent.php
|
||||
enterprise/meta/monitoring/wizard/wizard.update_module.php
|
||||
enterprise/godmode/wizards/Applications.class.php
|
||||
enterprise/godmode/wizards/Cloud.class.php
|
||||
enterprise/images/wizard/applications.png
|
||||
enterprise/images/wizard/cloud.png
|
||||
enterprise/images/wizard/consoletasks.png
|
||||
operation/incidents/configure_integriaims_incident.php
|
||||
operation/incidents/dashboard_detail_integriaims_incident.php
|
||||
operation/incidents/incident_statistics.php
|
||||
|
|
|
@ -262,7 +262,7 @@ $data[1] = '';
|
|||
$table_conditions->data[] = $data;
|
||||
|
||||
$data[0] = __('Use special days list');
|
||||
$data[1] = (isset($alert['special_day']) && $alert['special_day'] == 1) ? __('Yes') : __('No');
|
||||
$data[1] = (isset($template['special_day']) && (int) $template['special_day'] !== 0) ? __('Yes') : __('No');
|
||||
$table_conditions->data[] = $data;
|
||||
|
||||
$data[0] = __('Time threshold');
|
||||
|
|
|
@ -78,6 +78,17 @@ class SpecialDay extends Entity
|
|||
// Update.
|
||||
$updates = $this->fields;
|
||||
|
||||
$exist_special_days = $this->specialDays(
|
||||
[ '`talert_special_days`.*' ],
|
||||
['date_match' => $updates['date']]
|
||||
);
|
||||
|
||||
if (count($exist_special_days) > 0) {
|
||||
throw new \Exception(
|
||||
__('Already exist special day in this day.'),
|
||||
);
|
||||
}
|
||||
|
||||
$rs = \db_process_sql_update(
|
||||
$this->table,
|
||||
$updates,
|
||||
|
@ -94,6 +105,17 @@ class SpecialDay extends Entity
|
|||
// Creation.
|
||||
$inserts = $this->fields;
|
||||
|
||||
$exist_special_days = $this->specialDays(
|
||||
[ '`talert_special_days`.*' ],
|
||||
['date_match' => $inserts['date']]
|
||||
);
|
||||
|
||||
if (count($exist_special_days) > 0) {
|
||||
throw new \Exception(
|
||||
__('Already exist special day in this day.'),
|
||||
);
|
||||
}
|
||||
|
||||
// Clean null fields.
|
||||
foreach ($inserts as $k => $v) {
|
||||
if ($v === null) {
|
||||
|
|
|
@ -86,6 +86,16 @@ else
|
|||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
fi
|
||||
|
||||
# Delete old dprecated files
|
||||
if [ -f %{prefix}/pandora_console/extras/delete_files/delete_files.txt ] ; then
|
||||
echo "Deleting old deprecated files"
|
||||
cd %{prefix}/pandora_console/
|
||||
rm -rf `cat extras/delete_files/delete_files.txt`
|
||||
cd - > /dev/null
|
||||
echo "Done deleting deprecated files"
|
||||
|
||||
fi
|
||||
|
||||
%preun
|
||||
|
||||
# Upgrading
|
||||
|
|
|
@ -331,7 +331,7 @@ for ($month = 1; $month <= 12; $month++) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($week == 0 || $week == 6) {
|
||||
if ($week == 0 || $week == 6 || isset($specialDays[$display_year][$display_month][$day]) === true) {
|
||||
$cal_table->cellstyle[$cal_line][$week] = 'color: red;';
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ for ($month = 1; $month <= 12; $month++) {
|
|||
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
|
||||
$cal_table->data[$cal_line][$week] = $day.' ';
|
||||
|
||||
if ($is_management_allowed === true) {
|
||||
if ($is_management_allowed === true && isset($specialDays[$display_year][$display_month][$day]) === false) {
|
||||
$cal_table->data[$cal_line][$week] .= '<a href="'.$url.'&op=edit&date='.$date.'" title=';
|
||||
$cal_table->data[$cal_line][$week] .= __('Create');
|
||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
||||
|
|
|
@ -108,6 +108,7 @@ $inputs[] = [
|
|||
'returnAllGroup' => $display_all_group,
|
||||
'name' => 'id_group',
|
||||
'selected' => $specialDay->id_group(),
|
||||
'required' => true,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -535,19 +535,21 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
|
|||
# Get current time
|
||||
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time());
|
||||
|
||||
my @weeks = ( 'none', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'holiday');
|
||||
my $special_day;
|
||||
|
||||
# Check weekday
|
||||
if ($alert->{'special_day'}) {
|
||||
logger ($pa_config, "Checking special days '" . $alert->{'name'} . "'.", 10);
|
||||
my $date = sprintf("%4d%02d%02d", $year + 1900, $mon + 1, $mday);
|
||||
# '0001' means every year.
|
||||
my $date_every_year = sprintf("0001%02d%02d", $mon + 1, $mday);
|
||||
my $special_day = get_db_value ($dbh, 'SELECT day_code FROM talert_special_days WHERE (date = ? OR date = ?) AND (id_group = 0 OR id_group = ?) AND (id_calendar = ?) ORDER BY date DESC', $date, $date_every_year, $alert->{'id_group'}, $alert->{'special_day'});
|
||||
$special_day = get_db_value ($dbh, 'SELECT day_code FROM talert_special_days WHERE (date = ? OR date = ?) AND (id_group = 0 OR id_group = ?) AND (id_calendar = ?) ORDER BY date DESC', $date, $date_every_year, $alert->{'id_group'}, $alert->{'special_day'});
|
||||
|
||||
if (!defined($special_day)) {
|
||||
$special_day = 0;
|
||||
}
|
||||
|
||||
my @weeks = ( 'none', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'holiday');
|
||||
if ($special_day != 0) {
|
||||
logger ($pa_config, $date . " is a special day for " . $alert->{'name'} . ". (as a " . $weeks[$special_day] . ")", 10);
|
||||
return $status if (!defined($alert->{$weeks[$special_day]}) || $alert->{$weeks[$special_day]} == 0);
|
||||
|
@ -564,6 +566,9 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
|
|||
my $schedule;
|
||||
if (defined($alert->{'schedule'}) && $alert->{'schedule'} ne '') {
|
||||
$schedule = PandoraFMS::Tools::p_decode_json($pa_config, $alert->{'schedule'});
|
||||
if ($special_day != 0) {
|
||||
return $status if (!defined($schedule->{$weeks[$special_day]}));
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($schedule)) {
|
||||
|
@ -576,11 +581,18 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) {
|
|||
|
||||
my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec);
|
||||
|
||||
my $schedule_day;
|
||||
if ($special_day != 0 && defined($schedule->{$weeks[$special_day]})) {
|
||||
$schedule_day = $weeks[$special_day];
|
||||
} else {
|
||||
$schedule_day = $DayNames[$wday];
|
||||
}
|
||||
|
||||
#
|
||||
# Check time slots
|
||||
#
|
||||
my $inSlot = 0;
|
||||
foreach my $timeBlock (@{$schedule->{$DayNames[$wday]}}) {
|
||||
foreach my $timeBlock (@{$schedule->{$schedule_day}}) {
|
||||
if ($timeBlock->{'start'} eq $timeBlock->{'end'}) {
|
||||
# All day.
|
||||
$inSlot = 1;
|
||||
|
|
Loading…
Reference in New Issue