1 |
vpihour |
741 |
<?php |
2 |
|
|
/** |
3 |
|
|
* Ce script a pour objet de recuperer la liste des pétionnaires correspondant aux critères de recherche |
4 |
|
|
* |
5 |
|
|
* @package openfoncier |
6 |
|
|
* @version SVN : $Id$ |
7 |
|
|
*/ |
8 |
nhaye |
848 |
|
9 |
nhaye |
1119 |
require_once "../obj/utils.class.php"; |
10 |
nhaye |
848 |
|
11 |
nhaye |
1119 |
// Donnees |
12 |
|
|
$par_nom = (isset($_GET['par_nom']) ? $_GET['par_nom'] : "" ); |
13 |
|
|
$par_prenom = (isset($_GET['par_prenom']) ? $_GET['par_prenom'] : "" ); |
14 |
|
|
$mor_denomination = (isset($_GET['mor_denomination']) ? $_GET['mor_denomination'] : "" ); |
15 |
|
|
$mor_nom = (isset($_GET['mor_nom']) ? $_GET['mor_nom'] : "" ); |
16 |
|
|
$listData = ""; |
17 |
nhaye |
848 |
|
18 |
nhaye |
1119 |
$f = new utils("nohtml"); |
19 |
|
|
$f->disableLog(); |
20 |
|
|
|
21 |
|
|
$requete = "frequent is TRUE AND |
22 |
|
|
type_demandeur = 'petitionnaire' AND"; |
23 |
|
|
if($par_nom != "") { |
24 |
|
|
$requete .= " upper(particulier_nom) LIKE upper('%$par_nom%')"; |
25 |
|
|
$requete .= " AND"; |
26 |
|
|
} |
27 |
|
|
if($par_prenom != "") { |
28 |
|
|
$requete .= " upper(particulier_prenom) LIKE upper('%$par_prenom%')"; |
29 |
|
|
$requete .= " AND"; |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
if($mor_denomination != "") { |
33 |
|
|
$requete .= " upper(personne_morale_denomination) LIKE upper('%$mor_denomination%')"; |
34 |
|
|
$requete .= " AND"; |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
if($mor_nom != "") { |
38 |
|
|
$requete .= " upper(personne_morale_nom) LIKE upper('%$mor_nom%')"; |
39 |
|
|
$requete .= " AND"; |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
$requete = substr($requete, 0, (strlen($requete)-4)); |
43 |
|
|
|
44 |
|
|
$sql = |
45 |
|
|
"SELECT |
46 |
|
|
demandeur as value,". |
47 |
|
|
"trim(concat(particulier_nom,' ', particulier_prenom, ' ', ". |
48 |
|
|
"personne_morale_raison_sociale, ' ', personne_morale_denomination,". |
49 |
|
|
"' ', personne_morale_nom, ' ', personne_morale_siret, ' ', ". |
50 |
|
|
"personne_morale_nom, ' ', personne_morale_prenom, ' ',". |
51 |
|
|
" code_postal, ' ', localite)) as content ". |
52 |
|
|
"FROM ".DB_PREFIXE."demandeur WHERE ".$requete; |
53 |
|
|
|
54 |
|
|
$res = $f->db->query($sql); |
55 |
|
|
$f->isDatabaseError($res); |
56 |
|
|
$listData=array(); |
57 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
58 |
|
|
$listData[] = $row; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
echo json_encode($listData); |
62 |
|
|
|
63 |
vpihour |
741 |
?> |