diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php
index f265fd6ec3..ce6f814e95 100644
--- a/pandora_console/include/db/mysql.php
+++ b/pandora_console/include/db/mysql.php
@@ -760,7 +760,11 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
if ($field[0] != '`') {
// If the field is as
., don't scape.
if (strstr($field, '.') === false) {
- $field = '`'.$field.'`';
+ if (preg_match('/(UPPER|LOWER)(.+)/mi', $field)) {
+ $field = preg_replace('/(UPPER|LOWER])\((.+)\)/mi', '$1(`$2`)', $field);
+ } else {
+ $field = '`'.$field.'`';
+ }
}
}
diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php
index bab64dd5fe..b9b9c0bb59 100644
--- a/pandora_console/include/functions_custom_graphs.php
+++ b/pandora_console/include/functions_custom_graphs.php
@@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
function custom_graphs_search($id_group, $search)
{
if ($id_group != '' && $search != '') {
- $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND name LIKE "%'.$search.'%"');
+ $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (name LIKE "%'.$search.'%" OR description LIKE "'.$search.'")');
} else if ($id_group != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
} else {
- $all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%"');
+ $all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"');
}
if ($all_graphs === false) {
diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js
index 358dadcd68..c813c8e26a 100644
--- a/pandora_console/include/javascript/multiselect_filtered.js
+++ b/pandora_console/include/javascript/multiselect_filtered.js
@@ -1,5 +1,19 @@
/* global $, jQuery*/
+/**
+ * Custom selector for case instensitive contains.
+ */
+jQuery.expr[":"].iContains = jQuery.expr.createPseudo(function(arg) {
+ return function(elem) {
+ return (
+ jQuery(elem)
+ .text()
+ .toUpperCase()
+ .indexOf(arg.toUpperCase()) >= 0
+ );
+ };
+});
+
/**
* Add modules from available to selected.
*/
@@ -58,14 +72,14 @@ function filterItems(id, str) {
$("#" + id + " option[value=0]").remove();
// Move not matching elements filtered to tmp-id.
- var tmp = $("#" + id + " option:not(:contains(" + str + "))").toArray();
+ var tmp = $("#" + id + " option:not(:iContains(" + str + "))").toArray();
tmp.forEach(function(item) {
$("#tmp-" + id).append(item);
$(this).remove();
});
// Move matching filter back to id.
- tmp = $("#tmp-" + id + " option:contains(" + str + ")").toArray();
+ tmp = $("#tmp-" + id + " option:iContains(" + str + ")").toArray();
tmp.forEach(function(item) {
$("#" + id).append(item);
$(this).remove();
diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index 713ab22169..c5d597dd39 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -239,7 +239,8 @@ if ($free_search != '') {
WHERE id_agente IN (
SELECT id_agente
FROM tagente
- WHERE nombre LIKE "%'.$free_search.'%") OR alias LIKE "%'.$free_search.'%")'.')';
+ WHERE nombre COLLATE utf8_general_ci LIKE "%'.$free_search.'%")
+ OR alias COLLATE utf8_general_ci LIKE "%'.$free_search.'%")'.')';
} else {
$whereAlertSimple = '';
}
diff --git a/pandora_console/operation/search_alerts.getdata.php b/pandora_console/operation/search_alerts.getdata.php
index ccda38ee7e..73e2d8a048 100644
--- a/pandora_console/operation/search_alerts.getdata.php
+++ b/pandora_console/operation/search_alerts.getdata.php
@@ -139,32 +139,32 @@ if ($searchAlerts) {
switch ($config['dbtype']) {
case 'mysql':
$whereAlerts = 'AND (
- id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%'.$stringSearchSQL.'%") OR
+ id_alert_template IN (SELECT id FROM talert_templates WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%") OR
id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
- WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
+ WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%")) OR
talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
- WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
+ WHERE name COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%")) OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
- WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR
+ WHERE nombre COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%") OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente IN (
SELECT id_agente
FROM tagente
- WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
+ WHERE nombre COLLATE utf8_general_ci LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
)';
break;