1 |
vpihour |
741 |
<?php |
2 |
|
|
/** |
3 |
fmichon |
1515 |
* 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 |
|
|
$f = new utils("nohtml"); |
11 |
nhaye |
1122 |
$f->isAccredited(array("demande","demande_modifier","demande_ajouter"), "OR"); |
12 |
|
|
|
13 |
nhaye |
1119 |
$f->disableLog(); |
14 |
|
|
|
15 |
vpihour |
3209 |
// Donnees |
16 |
|
|
$par_nom = (isset($_POST['particulier_nom']) ? $f->clean_break($_POST['particulier_nom']) : "" ); |
17 |
|
|
$par_prenom = (isset($_POST['particulier_prenom']) ? $f->clean_break($_POST['particulier_prenom']) : "" ); |
18 |
|
|
$mor_denomination = (isset($_POST['personne_morale_denomination']) ? $f->clean_break($_POST['personne_morale_denomination']) : "" ); |
19 |
|
|
$mor_nom = (isset($_POST['mor_nom']) ? $f->clean_break($_POST['mor_nom']) : "" ); |
20 |
|
|
$listData = ""; |
21 |
|
|
|
22 |
nhaye |
1119 |
$requete = "frequent is TRUE AND |
23 |
|
|
type_demandeur = 'petitionnaire' AND"; |
24 |
|
|
if($par_nom != "") { |
25 |
|
|
$requete .= " upper(particulier_nom) LIKE upper('%$par_nom%')"; |
26 |
|
|
$requete .= " AND"; |
27 |
|
|
} |
28 |
|
|
if($par_prenom != "") { |
29 |
|
|
$requete .= " upper(particulier_prenom) LIKE upper('%$par_prenom%')"; |
30 |
|
|
$requete .= " AND"; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
if($mor_denomination != "") { |
34 |
|
|
$requete .= " upper(personne_morale_denomination) LIKE upper('%$mor_denomination%')"; |
35 |
|
|
$requete .= " AND"; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
if($mor_nom != "") { |
39 |
|
|
$requete .= " upper(personne_morale_nom) LIKE upper('%$mor_nom%')"; |
40 |
|
|
$requete .= " AND"; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
$requete = substr($requete, 0, (strlen($requete)-4)); |
44 |
|
|
|
45 |
|
|
$sql = |
46 |
|
|
"SELECT |
47 |
|
|
demandeur as value,". |
48 |
|
|
"trim(concat(particulier_nom,' ', particulier_prenom, ' ', ". |
49 |
|
|
"personne_morale_raison_sociale, ' ', personne_morale_denomination,". |
50 |
|
|
"' ', personne_morale_nom, ' ', personne_morale_siret, ' ', ". |
51 |
|
|
"personne_morale_nom, ' ', personne_morale_prenom, ' ',". |
52 |
|
|
" code_postal, ' ', localite)) as content ". |
53 |
|
|
"FROM ".DB_PREFIXE."demandeur WHERE ".$requete; |
54 |
|
|
|
55 |
|
|
$res = $f->db->query($sql); |
56 |
|
|
$f->isDatabaseError($res); |
57 |
|
|
$listData=array(); |
58 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
59 |
|
|
$listData[] = $row; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
echo json_encode($listData); |
63 |
|
|
|
64 |
vpihour |
741 |
?> |