isAccredited(array("demande","demande_modifier","demande_ajouter"), "OR"); //Récupération des valeurs envoyées $f->set_submitted_value(); $f->disableLog(); // Donnees $par_nom = ($f->get_submitted_post_value("particulier_nom") != null) ? $f->get_submitted_post_value("particulier_nom") : ""; $par_prenom = ($f->get_submitted_post_value("particulier_prenom'") != null) ? $f->get_submitted_post_value("particulier_prenom'") : ""; $mor_denomination = ($f->get_submitted_post_value("personne_morale_denomination") != null) ? $f->get_submitted_post_value("personne_morale_denomination") : ""; $mor_nom = ($f->get_submitted_post_value("mor_nom") != null) ? $f->get_submitted_post_value("mor_nom") : ""; $listData = ""; $requete = "frequent is TRUE AND type_demandeur = 'petitionnaire' AND"; if($par_nom != "") { $requete .= " upper(particulier_nom) LIKE upper('%$par_nom%')"; $requete .= " AND"; } if($par_prenom != "") { $requete .= " upper(particulier_prenom) LIKE upper('%$par_prenom%')"; $requete .= " AND"; } if($mor_denomination != "") { $requete .= " upper(personne_morale_denomination) LIKE upper('%$mor_denomination%')"; $requete .= " AND"; } if($mor_nom != "") { $requete .= " upper(personne_morale_nom) LIKE upper('%$mor_nom%')"; $requete .= " AND"; } $requete = substr($requete, 0, (strlen($requete)-4)); $sql = "SELECT demandeur as value,". "trim(concat(particulier_nom,' ', particulier_prenom, ' ', ". "personne_morale_raison_sociale, ' ', personne_morale_denomination,". "' ', personne_morale_nom, ' ', personne_morale_siret, ' ', ". "personne_morale_nom, ' ', personne_morale_prenom, ' ',". " code_postal, ' ', localite)) as content ". "FROM ".DB_PREFIXE."demandeur WHERE ".$requete; $res = $f->db->query($sql); $f->isDatabaseError($res); $listData=array(); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { $listData[] = $row; } echo json_encode($listData); ?>