#11537 Fix search with space entitites
This commit is contained in:
parent
f2b99cf38e
commit
b8e8a16e7d
|
@ -118,7 +118,7 @@ class ConfigPEN extends HTML
|
||||||
if (is_array($filter)) {
|
if (is_array($filter)) {
|
||||||
if (!empty($filter['free_search'])) {
|
if (!empty($filter['free_search'])) {
|
||||||
$sql_filters[] = vsprintf(
|
$sql_filters[] = vsprintf(
|
||||||
' AND (lower(`manufacturer`) like lower("%%%s%%")
|
' AND (lower(REPLACE(manufacturer, " ", " ")) like lower("%%%s%%")
|
||||||
OR pen = "%s") ',
|
OR pen = "%s") ',
|
||||||
array_fill(0, 2, $filter['free_search'])
|
array_fill(0, 2, $filter['free_search'])
|
||||||
);
|
);
|
||||||
|
@ -184,6 +184,7 @@ class ConfigPEN extends HTML
|
||||||
return db_get_value_sql($sql);
|
return db_get_value_sql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd($sql, true);
|
||||||
return db_get_all_rows_sql($sql);
|
return db_get_all_rows_sql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
|
||||||
function custom_graphs_search($id_group, $search)
|
function custom_graphs_search($id_group, $search)
|
||||||
{
|
{
|
||||||
if ($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.'%" OR description LIKE "'.$search.'")');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'")');
|
||||||
} else if ($id_group != '') {
|
} else if ($id_group != '') {
|
||||||
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
|
||||||
} else {
|
} else {
|
||||||
$all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($all_graphs === false) {
|
if ($all_graphs === false) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ function inventory_get_data(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inventory_search_string != '') {
|
if ($inventory_search_string != '') {
|
||||||
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
|
array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (int) get_parameter('offset');
|
$offset = (int) get_parameter('offset');
|
||||||
|
@ -746,7 +746,7 @@ function inventory_get_datatable(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inventory_search_string != '') {
|
if ($inventory_search_string != '') {
|
||||||
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
|
array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($utimestamp > 0) {
|
if ($utimestamp > 0) {
|
||||||
|
@ -889,7 +889,7 @@ function get_data_basic_info_sql($params, $count=false)
|
||||||
|
|
||||||
if ($params['search'] > 0) {
|
if ($params['search'] > 0) {
|
||||||
$where .= sprintf(
|
$where .= sprintf(
|
||||||
' AND ( alias LIKE "%%%s%%" )',
|
' AND ( REPLACE(alias, " ", " ") LIKE "%%%s%%" )',
|
||||||
$params['search']
|
$params['search']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1280,6 +1280,10 @@ if ($inventory_module !== 'basic') {
|
||||||
$style = 'width: 100%';
|
$style = 'width: 100%';
|
||||||
$ordering = true;
|
$ordering = true;
|
||||||
$searching = false;
|
$searching = false;
|
||||||
|
$search = [];
|
||||||
|
if (strlen($inventory_search_string) > 0) {
|
||||||
|
$search['value'] = $inventory_search_string;
|
||||||
|
}
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
'alias',
|
'alias',
|
||||||
|
@ -1329,6 +1333,7 @@ if ($inventory_module !== 'basic') {
|
||||||
'get_data_basic_info' => 1,
|
'get_data_basic_info' => 1,
|
||||||
'id_agent' => $id_agente,
|
'id_agent' => $id_agente,
|
||||||
'id_group' => $inventory_id_group,
|
'id_group' => $inventory_id_group,
|
||||||
|
'search' => $search,
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('Agent info not found'),
|
'zeroRecords' => __('Agent info not found'),
|
||||||
'emptyTable' => __('Agent info not found'),
|
'emptyTable' => __('Agent info not found'),
|
||||||
|
|
|
@ -74,15 +74,15 @@ if ($searchAgents) {
|
||||||
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
||||||
INNER JOIN taddress_agent ON
|
INNER JOIN taddress_agent ON
|
||||||
taddress.id_a = taddress_agent.id_a
|
taddress.id_a = taddress_agent.id_a
|
||||||
WHERE taddress.ip LIKE '$stringSearchSQL'";
|
WHERE LOWER(REPLACE(taddress.ip, ' ', ' ')) LIKE LOWER('$stringSearchSQL')";
|
||||||
|
|
||||||
$id = db_get_all_rows_sql($sql);
|
$id = db_get_all_rows_sql($sql);
|
||||||
if ($id != '') {
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.id_agente =".$aux;
|
t1.id_agente =".$aux;
|
||||||
|
|
||||||
$idCount = count($id);
|
$idCount = count($id);
|
||||||
|
@ -94,16 +94,16 @@ if ($searchAgents) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.direccion LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.direccion, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."'";
|
LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($has_secondary === true) {
|
if ($has_secondary === true) {
|
||||||
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
||||||
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
|
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE LOWER(REPLACE(nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')))";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
|
|
@ -139,64 +139,64 @@ if ($searchAlerts) {
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$whereAlerts = 'AND (
|
$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 REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR
|
||||||
id_alert_template IN (
|
id_alert_template IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_templates
|
FROM talert_templates
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
|
WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR
|
||||||
talert_template_modules.id IN (
|
talert_template_modules.id IN (
|
||||||
SELECT id_alert_template_module
|
SELECT id_alert_template_module
|
||||||
FROM talert_template_module_actions
|
FROM talert_template_module_actions
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
|
WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR
|
WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente IN (
|
WHERE id_agente IN (
|
||||||
SELECT id_agente
|
SELECT id_agente
|
||||||
FROM tagente
|
FROM tagente
|
||||||
WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
|
WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
|
||||||
)';
|
)';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$whereAlerts = 'AND (
|
$whereAlerts = 'AND (
|
||||||
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
||||||
id_alert_template IN (
|
id_alert_template IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_templates
|
FROM talert_templates
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
||||||
talert_template_modules.id IN (
|
talert_template_modules.id IN (
|
||||||
SELECT id_alert_template_module
|
SELECT id_alert_template_module
|
||||||
FROM talert_template_module_actions
|
FROM talert_template_module_actions
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente IN (
|
WHERE id_agente IN (
|
||||||
SELECT id_agente
|
SELECT id_agente
|
||||||
FROM tagente
|
FROM tagente
|
||||||
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
|
WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
|
||||||
)';
|
)';
|
||||||
$agents = false;
|
$agents = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,7 +31,7 @@ if ($searchGraphs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
$filter[] = "(upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%$".strtolower($stringSearchSQL)."%')";
|
$filter[] = "(upper(REPLACE(name, ' ', ' ')) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ')) LIKE '%$".strtolower($stringSearchSQL)."%')";
|
||||||
$filter['id_graph'] = $usergraphs_id;
|
$filter['id_graph'] = $usergraphs_id;
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
|
|
|
@ -62,10 +62,10 @@ $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
||||||
$id = db_get_all_rows_sql($sql);
|
$id = db_get_all_rows_sql($sql);
|
||||||
if ($id != '') {
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.id_agente =".$aux;
|
t1.id_agente =".$aux;
|
||||||
|
|
||||||
$idCount = count($id);
|
$idCount = count($id);
|
||||||
|
@ -77,16 +77,16 @@ if ($id != '') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.direccion LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.direccion, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."'";
|
REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($has_secondary === true) {
|
if ($has_secondary === true) {
|
||||||
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
||||||
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
|
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE REPLACE(nombre, ' ', ' ') LIKE '".$stringSearchSQL."'))";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
|
|
@ -32,7 +32,7 @@ if ((bool) $searchMaps === true) {
|
||||||
FROM tlayout tl
|
FROM tlayout tl
|
||||||
LEFT JOIN tlayout_data tld
|
LEFT JOIN tlayout_data tld
|
||||||
ON tl.id = tld.id_layout
|
ON tl.id = tld.id_layout
|
||||||
WHERE tl.name LIKE "%%%s%%"
|
WHERE REPLACE(tl.name, " ", " ") LIKE "%%%s%%"
|
||||||
AND tl.id_group IN (%s)
|
AND tl.id_group IN (%s)
|
||||||
GROUP BY tl.id, tl.name, tl.id_group',
|
GROUP BY tl.id, tl.name, tl.id_group',
|
||||||
$stringSearchSQL,
|
$stringSearchSQL,
|
||||||
|
|
|
@ -134,8 +134,8 @@ if ($searchModules) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
AND
|
AND
|
||||||
(t1.nombre LIKE "%'.$stringSearchSQL.'%" OR
|
(REPLACE(t1.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" OR
|
||||||
t3.nombre LIKE "%'.$stringSearchSQL.'%")
|
REPLACE(t3.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%")
|
||||||
AND t1.disabled = 0';
|
AND t1.disabled = 0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ if ($searchModules) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) AND
|
) AND
|
||||||
(t1.nombre LIKE \'%'.$stringSearchSQL.'%\' OR
|
(REPLACE(t1.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\' OR
|
||||||
t3.nombre LIKE \'%'.$stringSearchSQL.'%\')';
|
REPLACE(t3.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\')';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
|
@ -193,8 +193,8 @@ if ($searchModules) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) AND
|
) AND
|
||||||
(LOWER(t1.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
|
(LOWER(REPLACE(t1.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
|
||||||
LOWER(t3.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
|
LOWER(REPLACE(t3.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ if ($searchpolicies === true) {
|
||||||
|
|
||||||
$sql = "SELECT id, name, description, id_group, status
|
$sql = "SELECT id, name, description, id_group, status
|
||||||
FROM tpolicies
|
FROM tpolicies
|
||||||
WHERE name LIKE '$stringSearchSQL'
|
WHERE REPLACE(name, ' ', ' ') LIKE '$stringSearchSQL'
|
||||||
AND id_group IN ($id_user_groups_str)
|
AND id_group IN ($id_user_groups_str)
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,13 @@ if ($searchReports) {
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql = "SELECT id_report, name, description
|
$sql = "SELECT id_report, name, description
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT id_report, name, description
|
$sql = "SELECT id_report, name, description
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR description LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR REPLACE(description, ' ', ' ') LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,13 +77,13 @@ if ($searchReports) {
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql_count = "SELECT COUNT(id_report) AS count
|
$sql_count = "SELECT COUNT(id_report) AS count
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql_count = "SELECT COUNT(id_report) AS count
|
$sql_count = "SELECT COUNT(id_report) AS count
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,23 +179,23 @@ if ($searchUsers) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
||||||
WHERE fullname LIKE '%".$stringSearchSQL."%' OR
|
WHERE REPLACE(fullname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
id_user LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(id_user, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
firstname LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(firstname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
lastname LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(lastname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
middlename LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(middlename, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
email LIKE '%".$stringSearchSQL."%'
|
REPLACE(email, ' ', ' ') LIKE '%".$stringSearchSQL."%'
|
||||||
ORDER BY ".$order['field'].' '.$order['order'];
|
ORDER BY ".$order['field'].' '.$order['order'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
||||||
WHERE upper(fullname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
WHERE upper(REPLACE(fullname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(id_user) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(id_user, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(firstname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(firstname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(lastname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(lastname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(middlename) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(middlename, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(email) LIKE '%".strtolower($stringSearchSQL)."%'
|
upper(REPLACE(email, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%'
|
||||||
ORDER BY ".$order['field'].' '.$order['order'];
|
ORDER BY ".$order['field'].' '.$order['order'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue