1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 08/11/2012 14:00 |
4 |
|
5 |
include('../gen/sql/pgsql/demande.inc.php'); |
6 |
|
7 |
/*Champs du début de la requête*/ |
8 |
$table = DB_PREFIXE."demande |
9 |
INNER JOIN ".DB_PREFIXE."lien_demande_demandeur |
10 |
ON lien_demande_demandeur.demande=demande.demande |
11 |
AND lien_demande_demandeur.petitionnaire_principal IS TRUE |
12 |
INNER JOIN ".DB_PREFIXE."demandeur |
13 |
ON lien_demande_demandeur.demandeur=demandeur.demandeur |
14 |
LEFT JOIN ".DB_PREFIXE."arrondissement |
15 |
ON demande.arrondissement=arrondissement.arrondissement |
16 |
LEFT JOIN ".DB_PREFIXE."demande_type |
17 |
ON demande.demande_type=demande_type.demande_type |
18 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
19 |
ON demande.dossier_autorisation=dossier_autorisation.dossier_autorisation |
20 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
21 |
ON demande.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
22 |
LEFT JOIN ".DB_PREFIXE."dossier |
23 |
ON demande.dossier_instruction=dossier.dossier |
24 |
LEFT JOIN ".DB_PREFIXE."instruction |
25 |
ON demande.instruction_recepisse=instruction.instruction "; |
26 |
/* Test SQL pour récupérer les bons champs selon la qualité du demandeur : |
27 |
* particulier ou personne morale*/ |
28 |
$case_demandeur = "CASE WHEN demandeur.qualite='particulier' |
29 |
THEN TRIM(CONCAT(demandeur.particulier_nom, ' ', demandeur.particulier_prenom)) |
30 |
ELSE TRIM(CONCAT(demandeur.personne_morale_raison_sociale, ' ', demandeur.personne_morale_denomination)) |
31 |
END"; |
32 |
|
33 |
/*Supression du bouton d'ajout de nouvelle demande à partir du formulaire*/ |
34 |
$tab_actions['corner']['ajouter'] = NULL; |
35 |
|
36 |
/*Liste des champs affichés dans le tableau de résultat*/ |
37 |
$champAffiche = array( |
38 |
'demande.dossier_instruction as "'._("dossier").'"', |
39 |
$case_demandeur.' as "'._("nom").'"', |
40 |
'TRIM(CONCAT(demande.terrain_adresse_voie_numero,\' \', |
41 |
demande.complement,\' \', |
42 |
demande.terrain_adresse_lieu_dit,\' \', |
43 |
demande.terrain_adresse_code_postal,\' \', |
44 |
demande.terrain_adresse_localite,\' \', |
45 |
demande.terrain_adresse_bp,\' \', |
46 |
demande.terrain_adresse_cedex |
47 |
)) as "'._("terrain").'"', |
48 |
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"', |
49 |
'to_char(demande.date_demande ,\'DD/MM/YYYY\') as "'._("date_demande").'"', |
50 |
'arrondissement.libelle as "'._("arrondissement").'"', |
51 |
); |
52 |
|
53 |
/* Recherche avancée */ |
54 |
$champs = array(); |
55 |
|
56 |
$champs['dossier_instruction'] = array( |
57 |
'table' => 'dossier', |
58 |
'colonne' => 'dossier', |
59 |
'type' => 'text', |
60 |
'libelle' => _('dossier')); |
61 |
|
62 |
|
63 |
$champs['particulier_nom'] = |
64 |
array('colonne' => array('particulier_nom', 'personne_morale_denomination'), |
65 |
'table' => 'demandeur', |
66 |
'libelle' => _('petitionnaire'), |
67 |
'type' => 'text' |
68 |
); |
69 |
|
70 |
$champs['adresse'] = array( |
71 |
'table' => 'demande', |
72 |
'colonne' => array('terrain_adresse_voie_numero','complement', |
73 |
'terrain_adresse_lieu_dit', 'terrain_adresse_code_postal', |
74 |
'terrain_adresse_localite', 'terrain_adresse_bp', |
75 |
'terrain_adresse_cedex'), |
76 |
'type' => 'text', |
77 |
'libelle' => _('adresse')); |
78 |
|
79 |
$champs['arrondissement'] = |
80 |
array('colonne' => 'arrondissement', |
81 |
'table' => 'demande', |
82 |
'libelle' => _('arrondissement'), |
83 |
'type' => 'select' |
84 |
); |
85 |
|
86 |
$champs['dossier_autorisation_type_detaille'] = array( |
87 |
'table' => 'demande', |
88 |
'colonne' => 'dossier_autorisation_type_detaille', |
89 |
'type' => 'select', |
90 |
'libelle' => _('nature du dossier')); |
91 |
|
92 |
$champs['date_demande'] = |
93 |
array('colonne' => 'date_demande', |
94 |
'table' => 'demande', |
95 |
'libelle' => _('date_demande'), |
96 |
'type' => 'date', |
97 |
'where' => 'intervaldate'); |
98 |
|
99 |
$options[] = array('type' => 'search', |
100 |
'display' => true, |
101 |
'advanced' => $champs, |
102 |
'absolute_object' => 'demande', |
103 |
'export' => array("csv")); |
104 |
/*Fin recherche avancée*/ |
105 |
|
106 |
/*Sous-formulaire non affichés*/ |
107 |
$sousformulaire = NULL; |
108 |
?> |