1 |
vpihour |
688 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 14/11/2012 12:54 |
4 |
|
|
|
5 |
|
|
include('../gen/sql/pgsql/dossier_autorisation.inc.php'); |
6 |
vpihour |
1058 |
|
7 |
fmichon |
1420 |
$ent = _("autorisation")." -> "._("dossiers d'autorisation"); |
8 |
|
|
|
9 |
vpihour |
1058 |
/*Tables sur lesquels la requête va s'effectuer*/ |
10 |
nhaye |
722 |
$table = DB_PREFIXE."dossier_autorisation |
11 |
nhaye |
1638 |
LEFT OUTER JOIN ".DB_PREFIXE."lien_dossier_autorisation_demandeur |
12 |
nhaye |
722 |
ON lien_dossier_autorisation_demandeur.dossier_autorisation=dossier_autorisation.dossier_autorisation |
13 |
|
|
AND lien_dossier_autorisation_demandeur.petitionnaire_principal IS TRUE |
14 |
nhaye |
1638 |
LEFT OUTER JOIN ".DB_PREFIXE."demandeur |
15 |
nhaye |
722 |
ON lien_dossier_autorisation_demandeur.demandeur=demandeur.demandeur |
16 |
nhaye |
1638 |
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
17 |
nhaye |
722 |
ON dossier_autorisation.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
18 |
|
|
LEFT OUTER JOIN ".DB_PREFIXE."arrondissement |
19 |
vpihour |
1296 |
ON arrondissement.arrondissement=dossier_autorisation.arrondissement |
20 |
softime |
2283 |
LEFT JOIN ".DB_PREFIXE."etat_dossier_autorisation as eda |
21 |
|
|
ON dossier_autorisation.etat_dossier_autorisation = eda.etat_dossier_autorisation |
22 |
|
|
LEFT JOIN ".DB_PREFIXE."etat_dossier_autorisation as edda |
23 |
|
|
ON dossier_autorisation.etat_dernier_dossier_instruction_accepte = edda.etat_dossier_autorisation |
24 |
vpihour |
1296 |
LEFT JOIN ".DB_PREFIXE."dossier |
25 |
|
|
ON dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation AND dossier.date_decision = (SELECT MIN(dossier.date_decision) FROM ".DB_PREFIXE."dossier) |
26 |
|
|
LEFT JOIN ".DB_PREFIXE."parcelle |
27 |
|
|
ON dossier.parcelle = parcelle.parcelle"; |
28 |
vpihour |
1318 |
|
29 |
vpihour |
1296 |
// |
30 |
|
|
$case_demandeur = "CASE WHEN demandeur.qualite='particulier' |
31 |
|
|
THEN TRIM(CONCAT(demandeur.particulier_nom, ' ', demandeur.particulier_prenom)) |
32 |
|
|
ELSE TRIM(CONCAT(demandeur.personne_morale_raison_sociale, ' ', demandeur.personne_morale_denomination)) |
33 |
|
|
END"; |
34 |
softime |
2283 |
|
35 |
|
|
$case_etat = "CASE WHEN etat_dernier_dossier_instruction_accepte IS NULL |
36 |
|
|
THEN eda.libelle |
37 |
|
|
ELSE edda.libelle |
38 |
|
|
END"; |
39 |
vpihour |
1296 |
|
40 |
vpihour |
1058 |
/*Liste des champs affichés dans le tableau de résultat*/ |
41 |
nhaye |
722 |
$champAffiche = array( |
42 |
vpihour |
1296 |
'dossier_autorisation.dossier_autorisation as "'._("dossier").'"', |
43 |
softime |
2112 |
'dossier_autorisation.dossier_autorisation_libelle as "'._("dossier").'"', |
44 |
vpihour |
1296 |
$case_demandeur.' as "'._("nom du demandeur").'"', |
45 |
nhaye |
722 |
'TRIM(CONCAT(dossier_autorisation.terrain_adresse_voie_numero,\' \', |
46 |
softime |
2061 |
dossier_autorisation.terrain_adresse_voie,\' \', |
47 |
nhaye |
722 |
dossier_autorisation.terrain_adresse_lieu_dit,\' \', |
48 |
|
|
dossier_autorisation.terrain_adresse_code_postal,\' \', |
49 |
|
|
dossier_autorisation.terrain_adresse_localite,\' \', |
50 |
|
|
dossier_autorisation.terrain_adresse_bp,\' \', |
51 |
|
|
dossier_autorisation.terrain_adresse_cedex |
52 |
|
|
)) as "'._("adresse du terrain").'"', |
53 |
vpihour |
1296 |
'dossier_autorisation_type_detaille.code as "'._("dossier autorisation type detaille").'"', |
54 |
|
|
'to_char(dossier_autorisation.depot_initial ,\'DD/MM/YYYY\') as "'._("date de premier depot").'"', |
55 |
|
|
'to_char(dossier.date_decision ,\'DD/MM/YYYY\') as "'._("date de decision").'"', |
56 |
softime |
2283 |
$case_etat.' as "'._("etat").'"', |
57 |
nhaye |
722 |
); |
58 |
vpihour |
1058 |
|
59 |
|
|
/*Tri*/ |
60 |
vpihour |
1296 |
$tri="ORDER BY dossier_autorisation.dossier_autorisation ASC NULLS LAST "; |
61 |
vpihour |
1058 |
|
62 |
vpihour |
1296 |
//$selection = "WHERE dossier.date_decision = (SELECT MIN(dossier.date_decision) FROM ".DB_PREFIXE."dossier WHERE dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation)"; |
63 |
|
|
|
64 |
vpihour |
1058 |
/*Ordre*/ |
65 |
nhaye |
722 |
$edition="dossier_autorisation"; |
66 |
|
|
|
67 |
nhaye |
1288 |
|
68 |
|
|
$sousformulaire = array("lot", |
69 |
|
|
"dossier_instruction"); |
70 |
|
|
|
71 |
vpihour |
1296 |
// Configuration de la recherche avancée |
72 |
|
|
if (!isset($options)) { |
73 |
|
|
$options = array(); |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
$champs = array(); |
77 |
|
|
|
78 |
|
|
// Champs de la recherche avancée |
79 |
|
|
$champs['dossier'] = array( |
80 |
|
|
'table' => 'dossier_autorisation', |
81 |
|
|
'colonne' => 'dossier_autorisation', |
82 |
|
|
'type' => 'text', |
83 |
|
|
'taille' => 30, |
84 |
|
|
'libelle' => _('dossier')); |
85 |
|
|
|
86 |
|
|
$champs['dossier_autorisation_type_detaille'] = |
87 |
|
|
array('colonne' => 'dossier_autorisation_type_detaille', |
88 |
|
|
'table' => 'dossier_autorisation_type_detaille', |
89 |
|
|
'libelle' => _('dossier autorisation type detaille'), |
90 |
|
|
'type' => 'select' |
91 |
|
|
); |
92 |
|
|
|
93 |
|
|
$champs['petitionnaire'] = |
94 |
|
|
array('colonne' => array('particulier_nom', 'personne_morale_denomination'), |
95 |
|
|
'table' => 'demandeur', |
96 |
|
|
'libelle' => _('nom du demandeur'), |
97 |
fmichon |
1310 |
'type' => 'text', |
98 |
|
|
'taille' => 30, |
99 |
vpihour |
1296 |
); |
100 |
|
|
|
101 |
|
|
$champs['parcelle'] = |
102 |
|
|
array('colonne' => 'parcelle', |
103 |
|
|
'table' => 'parcelle', |
104 |
|
|
'libelle' => _('parcelle'), |
105 |
fmichon |
1310 |
'type' => 'text', |
106 |
|
|
'taille' => 30, |
107 |
vpihour |
1296 |
); |
108 |
|
|
|
109 |
|
|
$champs['adresse'] = array( |
110 |
|
|
'table' => 'dossier_autorisation', |
111 |
softime |
2061 |
'colonne' => array('terrain_adresse_voie_numero', 'terrain_adresse_voie', |
112 |
vpihour |
1296 |
'terrain_adresse_lieu_dit', 'terrain_adresse_code_postal', |
113 |
|
|
'terrain_adresse_localite', 'terrain_adresse_bp', |
114 |
|
|
'terrain_adresse_cedex'), |
115 |
|
|
'type' => 'text', |
116 |
fmichon |
1310 |
'taille' => 30, |
117 |
vpihour |
1296 |
'libelle' => _('adresse du terrain')); |
118 |
|
|
|
119 |
|
|
$champs['arrondissement'] = |
120 |
|
|
array('colonne' => 'arrondissement', |
121 |
|
|
'table' => 'dossier_autorisation', |
122 |
|
|
'libelle' => _('arrondissement'), |
123 |
|
|
'type' => 'select' |
124 |
|
|
); |
125 |
|
|
|
126 |
|
|
$champs['etat_dossier_autorisation'] = |
127 |
|
|
array('colonne' => 'etat_dossier_autorisation', |
128 |
|
|
'table' => 'etat_dossier_autorisation', |
129 |
|
|
'libelle' => _('etat'), |
130 |
|
|
'type' => 'select' |
131 |
|
|
); |
132 |
|
|
|
133 |
|
|
$champs['depot_initial'] = |
134 |
|
|
array('colonne' => 'date_depot', |
135 |
|
|
'table' => 'dossier_autorisation', |
136 |
|
|
'libelle' => _('date de premier depot'), |
137 |
|
|
'type' => 'date', |
138 |
fmichon |
1310 |
'taille' => 8, |
139 |
vpihour |
1296 |
'where' => 'intervaldate'); |
140 |
|
|
|
141 |
|
|
$champs['date_decision'] = |
142 |
|
|
array('colonne' => 'date_decision', |
143 |
|
|
'table' => 'dossier', |
144 |
|
|
'libelle' => _('date de decision'), |
145 |
|
|
'type' => 'date', |
146 |
fmichon |
1310 |
'taille' => 8, |
147 |
vpihour |
1296 |
'where' => 'intervaldate'); |
148 |
|
|
|
149 |
|
|
$options[] = array('type' => 'search', |
150 |
|
|
'display' => true, |
151 |
|
|
'advanced' => $champs, |
152 |
|
|
'default_form' => 'advanced', |
153 |
fmichon |
1418 |
'absolute_object' => 'dossier_autorisation',); |
154 |
vpihour |
1296 |
|
155 |
vpihour |
1300 |
//Lien vers le script spécifique de visualisation |
156 |
nhaye |
1780 |
if(!isset($advs_id)) { |
157 |
|
|
$advs_id = ""; |
158 |
|
|
} |
159 |
vpihour |
1300 |
// Action ajouter |
160 |
softime |
2120 |
$tab_actions['corner']["ajouter"] = |
161 |
|
|
array('lien' => '../scr/form.php?obj=demande_nouveau_dossier&action=0&idx=', |
162 |
|
|
'id' => '&premier='.$premier.'&recherche='.$recherche. |
163 |
|
|
'&tricol='.$tricol.'&selectioncol='.$selectioncol.'&advs_id='.$advs_id, |
164 |
|
|
'lib' => '<span class="om-icon om-icon-16 om-icon-fix add-16" title="'._('Ajouter').'">'._('Ajouter').'</span>', |
165 |
|
|
'rights' => array('list' => array('demande_nouveau_dossier', 'demande_nouveau_dossier_ajouter'), 'operator' => 'OR'), |
166 |
|
|
'ordre' => 10, |
167 |
|
|
'ajax' => false |
168 |
|
|
); |
169 |
|
|
|
170 |
vpihour |
1300 |
$tab_actions['content'] = |
171 |
|
|
array('lien' => '../app/dossier_autorisation.php?idx=', |
172 |
nhaye |
1780 |
'id' => '&premier='.$premier.'&recherche='.$recherche. |
173 |
|
|
'&tricol='.$tricol.'&selectioncol='.$selectioncol.'&advs_id='.$advs_id, |
174 |
vpihour |
1300 |
'lib' => '<span class="om-icon om-icon-16 om-icon-fix consult-16" title="'._('Consulter').'">'._('Consulter').'</span>', |
175 |
|
|
'rights' => array('list' => array($obj, $obj.'_consulter'), 'operator' => 'OR'), |
176 |
|
|
'ordre' => 10,); |
177 |
|
|
|
178 |
|
|
// Actions a gauche : consulter |
179 |
|
|
$tab_actions['left']['consulter'] =$tab_actions['content']; |
180 |
|
|
|
181 |
nhaye |
1279 |
//Cas du dossier d'autorisation en sous-formulaire du dossier d'instruction |
182 |
nhaye |
1287 |
if ( $retourformulaire == "dossier_instruction" OR |
183 |
|
|
$retourformulaire == "dossier_instruction_mes_encours" OR |
184 |
|
|
$retourformulaire == "dossier_instruction_mes_clotures" OR |
185 |
|
|
$retourformulaire == "dossier_instruction_tous_encours" OR |
186 |
|
|
$retourformulaire == "dossier_instruction_tous_cloturer" ){ |
187 |
nhaye |
1279 |
|
188 |
softime |
2112 |
$champAffiche = array( |
189 |
|
|
'dossier_autorisation.dossier_autorisation as "'._("dossier_autorisation").'"', |
190 |
|
|
'dossier_autorisation.dossier_autorisation_libelle as "'._("dossier_autorisation").'"', |
191 |
|
|
'\'Autorisation\' as "'._("type").'"', // XXX Le tri sur cette colonne provoque une erreur de BDD |
192 |
|
|
'to_char(dossier.date_depot ,\'DD/MM/YYYY\') as "'._("date_depot").'"', |
193 |
|
|
'etat_dossier_autorisation.libelle as "'._("etat").'"', |
194 |
|
|
); |
195 |
nhaye |
1279 |
|
196 |
|
|
$table = DB_PREFIXE.'dossier_autorisation |
197 |
|
|
LEFT JOIN '.DB_PREFIXE.'dossier |
198 |
nhaye |
1583 |
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation |
199 |
|
|
LEFT JOIN '.DB_PREFIXE.'etat_dossier_autorisation |
200 |
|
|
ON dossier_autorisation.etat_dossier_autorisation=etat_dossier_autorisation.etat_dossier_autorisation |
201 |
|
|
'; |
202 |
nhaye |
1279 |
|
203 |
|
|
$selection = 'WHERE dossier.dossier=\''.$idx.'\''; |
204 |
|
|
|
205 |
|
|
$tri = ""; |
206 |
|
|
|
207 |
|
|
// On met la ligne en couleur selon le type de condition |
208 |
|
|
$options[] = array( |
209 |
|
|
"type" => "condition", |
210 |
|
|
"field" => "'Autorisation'", |
211 |
|
|
"case" => array( |
212 |
|
|
array( |
213 |
|
|
"values" => array(_("Autorisation"), ), |
214 |
|
|
"style" => "tabDADI", |
215 |
|
|
|
216 |
|
|
), |
217 |
|
|
), |
218 |
|
|
); |
219 |
|
|
|
220 |
|
|
//Suppression du bouton d'ajout |
221 |
|
|
$tab_actions['corner']['ajouter'] = NULL; |
222 |
|
|
|
223 |
|
|
//Suppression du bouton d'ajout |
224 |
|
|
$tab_actions['left']["consulter"] = |
225 |
vpihour |
1324 |
array('lien' => '../app/dossier_autorisation.php?idx=', |
226 |
nhaye |
1780 |
'id' => '&premier='.$premier.'&recherche='.$recherche. |
227 |
|
|
'&tricol='.$tricol.'&selectioncol='.$selectioncol.'&retour='.$idx, |
228 |
nhaye |
1776 |
'lib' => '<span class="om-icon om-icon-16 om-icon-fix consult-16" title="'._('Consulter').'">'._('Consulter').'</span>', |
229 |
|
|
'rights' => array('list' => array($obj, $obj.'_consulter'), 'operator' => 'OR'), |
230 |
|
|
'ordre' => 10, |
231 |
|
|
'ajax' => false |
232 |
|
|
); |
233 |
vpihour |
1324 |
|
234 |
nhaye |
1279 |
|
235 |
|
|
$tab_actions['content'] = $tab_actions['left']["consulter"]; |
236 |
|
|
//Suppression de l'affichage |
237 |
|
|
$options[] = array( |
238 |
|
|
"type"=>"pagination", |
239 |
|
|
"display"=>false, |
240 |
|
|
); |
241 |
|
|
} |
242 |
vpihour |
688 |
?> |