Merge branch 'ent-5269-añadir-elemento-al-filtro-de-la-vista-de-administracion-general-de-alertas' into 'develop'

Ent 5269 añadir elemento al filtro de la vista de administracion general de alertas

See merge request artica/pandorafms!3796
This commit is contained in:
Daniel Rodriguez 2021-03-01 10:38:51 +00:00
commit 8ff36ef66f
2 changed files with 25 additions and 8 deletions

View File

@ -123,11 +123,15 @@ $form_filter .= "</td style='font-weight: bold;'>";
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td style='font-weight: bold;'>".__('Enabled / Disabled').'</td><td>'; $form_filter .= "<td style='font-weight: bold;'>".__('Status').'</td><td>';
$ed_list = []; $ed_list = [];
$ed_list[0] = __('Enabled'); $alert_status_filter = [];
$ed_list[1] = __('Disabled'); $alert_status_filter['all_enabled'] = __('All (Enabled)');
$form_filter .= html_print_select($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true); $alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true);
$form_filter .= "</td><td style='font-weight: bold;'>".__('Standby').'</td><td>'; $form_filter .= "</td><td style='font-weight: bold;'>".__('Standby').'</td><td>';
$sb_list = []; $sb_list = [];
$sb_list[1] = __('Standby on'); $sb_list[1] = __('Standby on');
@ -144,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
$form_filter .= '</td></tr>'; $form_filter .= '</td></tr>';
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td colspan='6' align='right'>"; $form_filter .= "<td colspan='6' align='right'>";
@ -174,8 +179,15 @@ $simple_alerts = [];
$total = 0; $total = 0;
$where = ''; $where = '';
if ($searchFlag) { if ($searchFlag) {
if ($status_alert === 'fired') {
$where .= ' AND talert_template_modules.times_fired > 0';
}
if ($status_alert === 'notfired') {
$where .= ' AND talert_template_modules.times_fired = 0';
}
if ($priority != -1 && $priority != '') { if ($priority != -1 && $priority != '') {
$where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')'; $where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')';
} }
@ -206,8 +218,12 @@ if ($searchFlag) {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))'; $where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
} }
if ($enabledisable != -1 && $enabledisable != '') { if ($status_alert === 'disabled') {
$where .= ' AND talert_template_modules.disabled ='.$enabledisable; $where .= ' AND talert_template_modules.disabled = 1';
}
if ($status_alert === 'all_enabled') {
$where .= ' AND talert_template_modules.disabled = 0';
} }
if ($standby != -1 && $standby != '') { if ($standby != -1 && $standby != '') {
@ -385,7 +401,7 @@ switch ($sortField) {
break; break;
} }
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group; $form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort; $sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) { if ($id_agente) {

View File

@ -65,6 +65,7 @@ $searchType = get_parameter('search_type', '');
$priority = get_parameter('priority', ''); $priority = get_parameter('priority', '');
$searchFlag = get_parameter('search', 0); $searchFlag = get_parameter('search', 0);
$enabledisable = get_parameter('enabledisable', ''); $enabledisable = get_parameter('enabledisable', '');
$status_alert = get_parameter('status_alert', '');
$standby = get_parameter('standby', ''); $standby = get_parameter('standby', '');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$ag_group = get_parameter('ag_group', 0); $ag_group = get_parameter('ag_group', 0);