. */ /** * @brief Script used by an Ajax autocompleter object to get the contacts data (from users or contacts) * * @file autocomplete_contacts.php * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup indexing_searching_mlb */ require_once('core/class/class_request.php'); $req = new request(); $db = new Database(); if (empty($_REQUEST['table'])) { exit(); } $table = $_REQUEST['table']; $_SESSION['is_multi_contact'] = 'OK'; $multi_sessions_address_id = $_SESSION['adresses']['addressid']; $user_ids = array(); // $user_ids = ''; $address_ids = array(); // $address_ids = ''; if(count($multi_sessions_address_id) > 0){ for ($imulti=0; $imulti <= count($multi_sessions_address_id); $imulti++) { if (is_numeric($multi_sessions_address_id[$imulti])) { array_push($address_ids, $multi_sessions_address_id[$imulti]); } else { array_push($user_ids, "'".$multi_sessions_address_id[$imulti]."'"); } } if (!empty($address_ids)) { $addresses = implode(' ,', $address_ids); $request_contact = " and ca_id not in (".$addresses.")"; } else { $request_contact = ''; } if (!empty($user_ids)) { $users = implode(' ,', $user_ids); $request_user = " and user_id not in (".$users.")"; } else { $request_user = ''; } } else{ $request_user = ''; $request_contact = ''; } if ($_SESSION['is_multi_contact'] == 'OK') { $noResultUsers = false; $noResultContacts = false; //USERS $select = array(); $select[$_SESSION['tablename']['users']]= array('lastname', 'firstname', 'user_id'); $where = " (lower(lastname) like lower(:input) " ."or lower(firstname) like lower(:input) " ."or user_id like :input) and (status = 'OK' or status = 'ABS') and enabled = 'Y'".$request_user; $other = 'order by lastname, firstname'; $arrayPDO = array(":input" => "%".$_REQUEST['Input']."%"); $res = $req->PDOselect($select, $where, $arrayPDO, $other, $_SESSION['config']['databasetype'], 11,false,"","","", false); echo ""; if($nb_step1 == 0 && $nb_step2 == 0 && $nb_step3 == 0 && $nb_step4 == 0 && $nb_step5 == 0 && $nb_step6 == 0){ $noResultContacts = true; } $nb_total = $nb_step1+$nb_step2+$nb_step3+$nb_step4+$nb_step5+$nb_step6; if ($nb_step1 > $m || $nb_step2 > $m || $nb_step3 > $m || $nb_step4 > $m || $nb_step5 > $m || $nb_step6 > $m) echo "

...".$nb_total." résulats au total

"; if($noResultUsers && $noResultContacts){ echo "

Aucun résultat trouvé.

"; } } //$_SESSION['is_multi_contact'] = '';