diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index ec8ce88c89..a4e1ffbc20 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -247,8 +247,27 @@ switch ($sortField) { $search_sql = ''; if ($search != "") { - $search_sql = " AND ( nombre " . $order_collation . " - LIKE '%$search%' OR direccion LIKE '%$search%') "; + $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress + INNER JOIN taddress_agent ON + taddress.id_a = taddress_agent.id_a + WHERE taddress.ip LIKE '%$search%'"; + + $id = db_get_all_rows_sql($sql); + if($id != ''){ + $aux = $id[0]['id_agent']; + $search_sql = " AND ( nombre " . $order_collation . " + LIKE '%$search%' OR tagente.id_agente = $aux"; + if(count($id)>=2){ + for ($i = 1; $i < count($id); $i++){ + $aux = $id[$i]['id_agent']; + $search_sql .= " OR tagente.id_agente = $aux"; + } + } + $search_sql .= ")"; + }else{ + $search_sql = " AND ( nombre " . $order_collation . " + LIKE '%$search%') "; + } } if ($disabled == 1)