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 |
vpihour |
3264 |
//Récupération des valeurs envoyées |
13 |
|
|
$f->set_submitted_value(); |
14 |
nhaye |
1119 |
$f->disableLog(); |
15 |
|
|
|
16 |
vpihour |
3209 |
// Donnees |
17 |
nmeucci |
3228 |
$par_nom = ($f->get_submitted_get_value("par_nom") != null) ? $f->get_submitted_get_value("par_nom") : ""; |
18 |
|
|
$par_prenom = ($f->get_submitted_get_value("par_prenom") != null) ? $f->get_submitted_get_value("par_prenom") : ""; |
19 |
|
|
$mor_denomination = ($f->get_submitted_get_value("mor_denomination") != null) ? $f->get_submitted_get_value("mor_denomination") : ""; |
20 |
|
|
$mor_nom = ($f->get_submitted_get_value("mor_nom") != null) ? $f->get_submitted_get_value("mor_nom") : ""; |
21 |
vpihour |
3209 |
$listData = ""; |
22 |
|
|
|
23 |
nhaye |
1119 |
$requete = "frequent is TRUE AND |
24 |
|
|
type_demandeur = 'petitionnaire' AND"; |
25 |
|
|
if($par_nom != "") { |
26 |
|
|
$requete .= " upper(particulier_nom) LIKE upper('%$par_nom%')"; |
27 |
|
|
$requete .= " AND"; |
28 |
|
|
} |
29 |
|
|
if($par_prenom != "") { |
30 |
|
|
$requete .= " upper(particulier_prenom) LIKE upper('%$par_prenom%')"; |
31 |
|
|
$requete .= " AND"; |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
if($mor_denomination != "") { |
35 |
|
|
$requete .= " upper(personne_morale_denomination) LIKE upper('%$mor_denomination%')"; |
36 |
|
|
$requete .= " AND"; |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
if($mor_nom != "") { |
40 |
|
|
$requete .= " upper(personne_morale_nom) LIKE upper('%$mor_nom%')"; |
41 |
|
|
$requete .= " AND"; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
$requete = substr($requete, 0, (strlen($requete)-4)); |
45 |
|
|
|
46 |
|
|
$sql = |
47 |
|
|
"SELECT |
48 |
|
|
demandeur as value,". |
49 |
|
|
"trim(concat(particulier_nom,' ', particulier_prenom, ' ', ". |
50 |
|
|
"personne_morale_raison_sociale, ' ', personne_morale_denomination,". |
51 |
|
|
"' ', personne_morale_nom, ' ', personne_morale_siret, ' ', ". |
52 |
|
|
"personne_morale_nom, ' ', personne_morale_prenom, ' ',". |
53 |
|
|
" code_postal, ' ', localite)) as content ". |
54 |
|
|
"FROM ".DB_PREFIXE."demandeur WHERE ".$requete; |
55 |
|
|
|
56 |
|
|
$res = $f->db->query($sql); |
57 |
|
|
$f->isDatabaseError($res); |
58 |
|
|
$listData=array(); |
59 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
60 |
|
|
$listData[] = $row; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
echo json_encode($listData); |
64 |
|
|
|
65 |
vpihour |
741 |
?> |