Skip to content
Snippets Groups Projects
Commit 30fd38a0 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #3120 change sql search and add firstname in display

parent 0f588d00
No related branches found
No related tags found
No related merge requests found
...@@ -46,13 +46,14 @@ if ($whereSecurityOnEntities == '') { ...@@ -46,13 +46,14 @@ if ($whereSecurityOnEntities == '') {
$db = new Database(); $db = new Database();
$stmt = $db->query( $stmt = $db->query(
"SELECT DISTINCT(users.user_id), users.lastname as tag FROM users, users_entities " "SELECT DISTINCT(users.user_id), CONCAT(users.lastname,' ',users.firstname) as tag FROM users, users_entities "
. " WHERE (" . " WHERE ("
. "lower(users.lastname) like lower(:what) " . "lower(users.lastname) like lower(:what) "
. " or lower(users.user_id) like lower(:what) " . " or lower(users.user_id) like lower(:what) "
. " or lower(users.firstname) like lower(:what) "
. ") and users.status <> 'DEL' " . $whereSecurityOnEntities . " and (users.user_id = users_entities.user_id) " . ") and users.status <> 'DEL' " . $whereSecurityOnEntities . " and (users.user_id = users_entities.user_id) "
. " order by users.lastname", . " order by tag",
array(':what' => $_REQUEST['what'].'%') array(':what' => '%'.$_REQUEST['what'].'%')
); );
$listArray = array(); $listArray = array();
......
...@@ -175,8 +175,8 @@ function display_list(){ ...@@ -175,8 +175,8 @@ function display_list(){
$arrayPDO = array(); $arrayPDO = array();
if(isset($_REQUEST['what'])){ if(isset($_REQUEST['what'])){
$what = $_REQUEST['what']; $what = $_REQUEST['what'];
$where .= " and (lower(lastname) like lower(?) or lower(users.user_id) like lower(?) )"; $where .= " and (lower(lastname) like lower(?) or lower(users.user_id) like lower(?) or CONCAT(users.lastname,' ',users.firstname) like ?)";
$arrayPDO = array($what.'%', $what.'%'); $arrayPDO = array($what.'%', $what.'%', $what);
} }
// Checking order and order_field values // Checking order and order_field values
...@@ -195,7 +195,6 @@ function display_list(){ ...@@ -195,7 +195,6 @@ function display_list(){
if($entities_loaded == true ){ if($entities_loaded == true ){
$tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype']); $tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype']);
} else { } else {
require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php');
$ent = new entity(); $ent = new entity();
$my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']);
...@@ -209,8 +208,8 @@ function display_list(){ ...@@ -209,8 +208,8 @@ function display_list(){
$what = ''; $what = '';
if(isset($_REQUEST['what'])){ if(isset($_REQUEST['what'])){
$what = $_REQUEST['what']; $what = $_REQUEST['what'];
$where .= " and lower(lastname) like lower(?)"; $where .= " and lower(lastname) like lower(?) or CONCAT(users.lastname,' ',users.firstname) like ?";
$arrayPDO = array($what.'%'); $arrayPDO = array($what.'%',$what);
} }
// Checking order and order_field values // Checking order and order_field values
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment