Merge branch '4003-Arreglos-en-servicios' into 'develop'

4003 arreglos en servicios

See merge request artica/pandorafms!2621
This commit is contained in:
Daniel Rodriguez 2019-08-09 09:04:17 +02:00
commit 57fcfee36c
2 changed files with 25 additions and 13 deletions

View File

@ -63,6 +63,7 @@ if ($get_agents_group) {
if ($search_agents && (!is_metaconsole() || $force_local)) {
$id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q');
$string = strtoupper($string);
// q is what autocomplete plugin gives
$id_group = (int) get_parameter('id_group', -1);
$addedItems = html_entity_decode((string) get_parameter('add'));
@ -98,11 +99,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_alias = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_alias[] = '(alias LIKE "%'.$string.'%")';
$filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_alias[] = '(alias LIKE \'%'.$string.'%\')';
$filter_alias[] = '(UPPER(alias) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
@ -127,11 +128,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_agents = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_agents[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
$filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')';
$filter_agents[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
@ -156,11 +157,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_address = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_address[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
$filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')';
$filter_address[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
@ -185,11 +186,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_description = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_description[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
$filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
$filter_description[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) NOT LIKE \'%'.$string.'%\' AND UPPER(comentarios) LIKE \'%'.$string.'%\')';
break;
case 'oracle':

View File

@ -214,26 +214,37 @@ class TreeService extends Tree
foreach ($data_modules as $key => $module) {
switch ($module['estado']) {
case '0':
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_ok_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
$module_status = 'ok';
$module_title = 'NORMAL';
break;
case '1':
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_critical_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
$module_status = 'critical';
$module_title = 'CRITICAL';
break;
case '2':
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
$module_status = 'warning';
$module_title = 'WARNING';
break;
case '3':
$module_status = 'down';
$module_title = 'UNKNOWN';
break;
case '4':
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_no_data_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
$module_status = 'no_data';
$module_title = 'NOT INITIALIZED';
break;
default:
// code...
$module_status = 'down';
$module_title = 'UNKNOWN';
break;
}
$data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_'.$module_status.'_ball.png" data-title="'.$module_title.' status." data-use_title_for_force_title="1" class="forced_title" alt="'.$module_title.' status." />';
$data_modules[$key]['showEventsBtn'] = 1;
$data_modules[$key]['eventModule'] = $module['id_agente_modulo'];
}