Merge branch 'ent-11760-15978-anadir-el-filtro-en-el-estado-de-eventos-not-acknowledged' into 'develop'

add new type search status events not in process pandora_enterprise#11760

See merge request artica/pandorafms!6491
This commit is contained in:
Rafael Ameijeiras 2023-11-27 10:41:28 +00:00
commit e5c708298b
5 changed files with 65 additions and 10 deletions

View File

@ -45,6 +45,7 @@ define('EVENT_NEW', 0);
define('EVENT_VALIDATE', 1);
define('EVENT_PROCESS', 2);
define('EVENT_NO_VALIDATED', 3);
define('EVENT_NO_PROCESS', 4);
// Events group by constants.
define('EVENT_GROUP_REP_ALL', 0);

View File

@ -982,6 +982,9 @@ function events_get_all(
case EVENT_NO_VALIDATED:
$filter['status'][$key] = (EVENT_NEW.', '.EVENT_PROCESS);
case EVENT_NO_PROCESS:
$filter['status'][$key] = (EVENT_NEW.', '.EVENT_VALIDATE);
default:
// Ignore.
break;
@ -1027,6 +1030,24 @@ function events_get_all(
$validatedState
);
break;
case EVENT_NO_PROCESS:
// Show comments in validated events.
$validatedState = '';
if ($validatedEvents === true) {
$validatedState = sprintf(
'OR estado = %d',
EVENT_VALIDATE
);
}
$sql_filters[] = sprintf(
' AND (estado = %d OR estado = %d %s)',
EVENT_NEW,
EVENT_VALIDATE,
$validatedState
);
break;
}
}
}
@ -3204,12 +3225,14 @@ function events_get_all_status($report=false)
$fields[1] = __('Only validated');
$fields[2] = __('Only in process');
$fields[3] = __('Only not validated');
$fields[4] = __('Only not in process');
} else {
$fields[-1] = __('All event');
$fields[0] = __('New');
$fields[1] = __('Validated');
$fields[2] = __('In process');
$fields[3] = __('Not Validated');
$fields[4] = __('Not in process');
}
return $fields;
@ -5999,17 +6022,47 @@ function get_count_event_criticity(
$type = 'AND event_type = "'.$eventType.'"';
}
$groups = ' ';
$groups = ' ';
if ((int) $groupId !== 0) {
$groups = 'AND id_grupo IN ('.$groupId.')';
}
$status = ' ';
if ((int) $eventStatus !== -1) {
$status = 'AND estado = '.$eventStatus;
$status = ' ';
if (empty($eventStatus) === false) {
switch ($eventStatus) {
case EVENT_ALL:
default:
// Do not filter.
break;
case EVENT_NEW:
case EVENT_VALIDATE:
case EVENT_PROCESS:
$status = sprintf(
' AND estado = %d',
$eventStatus
);
break;
case EVENT_NO_VALIDATED:
$status = sprintf(
' AND (estado = %d OR estado = %d)',
EVENT_NEW,
EVENT_PROCESS
);
break;
case EVENT_NO_PROCESS:
$status = sprintf(
' AND (estado = %d OR estado = %d)',
EVENT_NEW,
EVENT_VALIDATE
);
break;
}
}
$criticity = ' ';
$criticity = ' ';
if (empty($criticityId) === false) {
$criticity = 'AND criticity IN ('.$criticityId.')';
}

View File

@ -296,11 +296,7 @@ class EventCardboard extends Widget
];
// Event status.
$fields = [
-1 => __('All event'),
1 => __('Only validated'),
0 => __('Only pending'),
];
$fields = events_get_all_status(true);
$inputs['inputs']['row1'][] = [
'label' => __('Event status'),

View File

@ -396,6 +396,7 @@ class EventsListWidget extends Widget
0 => \__('Only pending'),
2 => \__('Only in process'),
3 => \__('Only not validated'),
4 => \__('Only not in process'),
];
$inputs['inputs']['row1'][] = [

View File

@ -2663,6 +2663,10 @@ try {
case EVENT_NO_VALIDATED:
$active_filters_div .= __('Not validated.');
break;
case EVENT_NO_PROCESS:
$active_filters_div .= __('Not in process.');
break;
}
$active_filters_div .= '</div>';