1 |
<?php |
2 |
//$Id: dossier.inc.php 5232 2015-09-30 10:41:34Z stimezouaght $ |
3 |
//gen openMairie le 10/02/2011 20:39 |
4 |
include('../gen/sql/pgsql/dossier.inc.php'); |
5 |
|
6 |
/*Tables sur lesquels la requête va s'effectuer*/ |
7 |
$table = DB_PREFIXE."dossier |
8 |
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur |
9 |
ON lien_dossier_demandeur.dossier=dossier.dossier |
10 |
AND lien_dossier_demandeur.petitionnaire_principal IS TRUE |
11 |
LEFT JOIN ".DB_PREFIXE."demandeur |
12 |
ON lien_dossier_demandeur.demandeur=demandeur.demandeur |
13 |
LEFT JOIN ".DB_PREFIXE."instructeur |
14 |
ON dossier.instructeur = instructeur.instructeur |
15 |
LEFT JOIN ".DB_PREFIXE."om_utilisateur |
16 |
ON instructeur.om_utilisateur = om_utilisateur.om_utilisateur |
17 |
LEFT JOIN ".DB_PREFIXE."avis_decision |
18 |
ON avis_decision.avis_decision=dossier.avis_decision |
19 |
LEFT JOIN ".DB_PREFIXE."division |
20 |
ON dossier.division=division.division"; |
21 |
|
22 |
/*Champs du début de la requête*/ |
23 |
$champAffiche=array( |
24 |
'dossier.dossier as "'._("dossier").'"', |
25 |
'TRIM(CONCAT(personne_morale_denomination,\' \',personne_morale_nom,\' \',demandeur.particulier_nom)) as "'._("petitionaire").'"', |
26 |
'instructeur.nom as "'._("instructeur").'"', |
27 |
'to_char(dossier.date_demande ,\'DD/MM/YYYY\') as "'._("date_demande").'"', |
28 |
'dossier.date_dernier_depot as "'._("date_dernier_depot").'"', |
29 |
'to_char(dossier.date_complet ,\'DD/MM/YYYY\') as "'._("date_complet").'"', |
30 |
'to_char(dossier.date_notification_delai ,\'DD/MM/YYYY\') as "'._("date_notification_delai").'"', |
31 |
'to_char(dossier.date_limite ,\'DD/MM/YYYY\') as "'._("date_limite").'"', |
32 |
'etat as "'._("etat").'"', |
33 |
'avis_decision.libelle as "'._("avis_decision").'"', |
34 |
'CASE WHEN dossier.enjeu_erp is TRUE THEN \'<span class="om-icon om-icon-16 om-icon-fix enjeu_erp-16" title="'._('Enjeu ERP').'">ERP</span>\' ELSE \'\' END || |
35 |
CASE WHEN dossier.enjeu_urba is TRUE THEN \'<span class="om-icon om-icon-16 om-icon-fix enjeu_urba-16" title="'._('Enjeu Urba').'">URBA</span>\' ELSE \'\' END |
36 |
as "'._("enjeu").'"', |
37 |
); |
38 |
|
39 |
/*Tri*/ |
40 |
$triOrder= "order by dossier.dossier"; |
41 |
$tri = $triOrder; |
42 |
|
43 |
/*Recherche simple*/ |
44 |
$champRecherche=array( 'dossier.dossier as "'._("dossier").'"', |
45 |
'personne_morale_denomination as "'._("personne_morale_denomination").'"', |
46 |
'particulier_nom as "'._("particulier_nom").'"', |
47 |
); |
48 |
|
49 |
/*Icone*/ |
50 |
$ico = "../img/ico_dossier.png"; |
51 |
|
52 |
$edition=""; |
53 |
|
54 |
/** |
55 |
* OPTIONS |
56 |
*/ |
57 |
// |
58 |
if (!isset($options)) { |
59 |
$options = array(); |
60 |
} |
61 |
|
62 |
/*Si l'on se trouve dans le formulaire dossier_instruction*/ |
63 |
if (isset($_GET["obj"]) && $_GET["obj"] == "dossier_instruction") { |
64 |
/** |
65 |
* OPTIONS - ADVSEARCH |
66 |
*/ |
67 |
// Options pour les select de faux booléens |
68 |
$args = array( |
69 |
0 => array("", "Oui", "Non", ), |
70 |
1 => array(_("choisir")." "._("accord_tacite"), _("Oui"), _("Non"), ), |
71 |
); |
72 |
// |
73 |
$champs['dossier'] = array( |
74 |
'libelle' => _('dossier'), |
75 |
'type' => 'text', |
76 |
'table' => 'dossier', |
77 |
'colonne' => array( |
78 |
'dossier', |
79 |
'dossier_libelle', |
80 |
), |
81 |
'taille' => 30, |
82 |
); |
83 |
// |
84 |
$champs['dossier_autorisation_type_detaille'] = array( |
85 |
'table' => 'dossier_autorisation_type_detaille', |
86 |
'colonne' => 'dossier_autorisation_type_detaille', |
87 |
'type' => 'select', |
88 |
'taille' => 30, |
89 |
'libelle' => _('dossier_autorisation_type_detaille'), |
90 |
); |
91 |
// |
92 |
$champs['particulier'] = array( |
93 |
'libelle' => _('Demandeur'), |
94 |
'help' => _("Recherche dans les champs : nom, prénom, raison sociale, dénomination. |
95 |
|
96 |
La chaîne recherchée doit figurer dans l'un de ces champs. |
97 |
|
98 |
Par exemple, dans le cas d'un demandeur avec le nom 'DUPONT' et le prénom 'JEAN' : |
99 |
- la recherche de 'JEAN' donne des résultats car le champ prénom contient 'JEAN', |
100 |
- la recherche de 'DUPONT' donne des résultats car le champ nom contient 'DUPONT', |
101 |
- la recherche de 'DUPONT JEAN' ne donne aucun résultat car ni le nom ni le prénom ni la raison sociale ni la dénomination ne contient 'DUPONT JEAN'."), |
102 |
'type' => 'text', |
103 |
'table' => 'demandeur', |
104 |
'colonne' => array( |
105 |
'particulier_nom', |
106 |
'particulier_prenom', |
107 |
'personne_morale_raison_sociale', |
108 |
'personne_morale_denomination', |
109 |
), |
110 |
'taille' => 30, |
111 |
); |
112 |
// |
113 |
$champs['parcelle'] = array( |
114 |
'table' => 'dossier_parcelle', |
115 |
'where' => 'injoin', |
116 |
'tablejoin' => 'INNER JOIN (SELECT DISTINCT dossier FROM '.DB_PREFIXE.'dossier_parcelle WHERE lower(dossier_parcelle.libelle) like %s ) AS A1 ON A1.dossier = dossier.dossier' , |
117 |
'colonne' => 'libelle', |
118 |
'type' => 'text', |
119 |
'taille' => 30, |
120 |
'libelle' => _('parcelle'), |
121 |
); |
122 |
// |
123 |
$champs['etat'] = array( |
124 |
'table' => 'dossier', |
125 |
'colonne' => 'etat', |
126 |
'type' => 'select', |
127 |
'libelle' => _('etat'), |
128 |
); |
129 |
// |
130 |
$champs['accord_tacite'] = array( |
131 |
'table' => 'dossier', |
132 |
'colonne' => 'accord_tacite', |
133 |
'type' => 'select', |
134 |
"subtype" => "manualselect", |
135 |
'libelle' => _('accord_tacite'), |
136 |
"args" => $args, |
137 |
); |
138 |
// |
139 |
$champs['instructeur'] = array( |
140 |
'table' => 'dossier', |
141 |
'colonne' => 'instructeur', |
142 |
'type' => 'select', |
143 |
'libelle' => _('instructeur'), |
144 |
); |
145 |
// |
146 |
if ($_SESSION['niveau'] == '2') { |
147 |
$champs['instructeur']['subtype'] = 'sqlselect'; |
148 |
$champs['instructeur']['sql'] = "SELECT instructeur.instructeur, instructeur.nom||' ('||division.code||')' |
149 |
FROM ".DB_PREFIXE."instructeur |
150 |
INNER JOIN ".DB_PREFIXE."division ON division.division=instructeur.division |
151 |
WHERE ((instructeur.om_validite_debut IS NULL AND (instructeur.om_validite_fin IS NULL OR instructeur.om_validite_fin > CURRENT_DATE)) OR (instructeur.om_validite_debut <= CURRENT_DATE AND (instructeur.om_validite_fin IS NULL OR instructeur.om_validite_fin > CURRENT_DATE))) |
152 |
ORDER BY nom"; |
153 |
} |
154 |
// |
155 |
$champs['date_depot'] = array( |
156 |
'colonne' => 'date_depot', |
157 |
'table' => 'dossier', |
158 |
'libelle' => _('date_depot'), |
159 |
'lib1'=> _("debut"), |
160 |
'lib2' => _("fin"), |
161 |
'type' => 'date', |
162 |
'taille' => 8, |
163 |
'where' => 'intervaldate', |
164 |
); |
165 |
// |
166 |
$champs['date_rejet'] = array( |
167 |
'colonne' => 'date_rejet', |
168 |
'table' => 'dossier', |
169 |
'libelle' => _('date_rejet'), |
170 |
'lib1'=> _("debut"), |
171 |
'lib2' => _("fin"), |
172 |
'type' => 'date', |
173 |
'taille' => 8, |
174 |
'where' => 'intervaldate', |
175 |
); |
176 |
// |
177 |
$champs['date_validite'] = array( |
178 |
'colonne' => 'date_validite', |
179 |
'table' => 'dossier', |
180 |
'libelle' => _('date_validite'), |
181 |
'lib1'=> _("debut"), |
182 |
'lib2' => _("fin"), |
183 |
'type' => 'date', |
184 |
'taille' => 8, |
185 |
'where' => 'intervaldate', |
186 |
); |
187 |
// |
188 |
$champs['date_complet'] = array( |
189 |
'colonne' => 'date_complet', |
190 |
'table' => 'dossier', |
191 |
'libelle' => _('date_complet'), |
192 |
'lib1'=> _("debut"), |
193 |
'lib2' => _("fin"), |
194 |
'type' => 'date', |
195 |
'taille' => 8, |
196 |
'where' => 'intervaldate', |
197 |
); |
198 |
// |
199 |
$champs['date_decision'] = array( |
200 |
'colonne' => 'date_decision', |
201 |
'table' => 'dossier', |
202 |
'libelle' => _('date_decision'), |
203 |
'lib1'=> _("debut"), |
204 |
'lib2' => _("fin"), |
205 |
'type' => 'date', |
206 |
'taille' => 8, |
207 |
'where' => 'intervaldate', |
208 |
); |
209 |
// |
210 |
$champs['date_limite'] = array( |
211 |
'colonne' => 'date_limite', |
212 |
'table' => 'dossier', |
213 |
'libelle' => _('date_limite'), |
214 |
'lib1'=> _("debut"), |
215 |
'lib2' => _("fin"), |
216 |
'type' => 'date', |
217 |
'taille' => 8, |
218 |
'where' => 'intervaldate', |
219 |
); |
220 |
// |
221 |
$champs['date_chantier'] = array( |
222 |
'colonne' => 'date_chantier', |
223 |
'table' => 'dossier', |
224 |
'libelle' => _('date_chantier'), |
225 |
'lib1'=> _("debut"), |
226 |
'lib2' => _("fin"), |
227 |
'type' => 'date', |
228 |
'taille' => 8, |
229 |
'where' => 'intervaldate', |
230 |
); |
231 |
// |
232 |
$champs['date_achevement'] = array( |
233 |
'colonne' => 'date_achevement', |
234 |
'table' => 'dossier', |
235 |
'libelle' => _('date_achevement'), |
236 |
'lib1'=> _("debut"), |
237 |
'lib2' => _("fin"), |
238 |
'type' => 'date', |
239 |
'taille' => 8, |
240 |
'where' => 'intervaldate', |
241 |
); |
242 |
// |
243 |
$champs['date_conformite'] = array( |
244 |
'colonne' => 'date_conformite', |
245 |
'table' => 'dossier', |
246 |
'libelle' => _('date_conformite'), |
247 |
'lib1'=> _("debut"), |
248 |
'lib2' => _("fin"), |
249 |
'type' => 'date', |
250 |
'taille' => 8, |
251 |
'where' => 'intervaldate', |
252 |
); |
253 |
// |
254 |
if ($_SESSION['niveau'] == '2') { |
255 |
$champs['om_collectivite'] = array( |
256 |
'table' => 'dossier', |
257 |
'colonne' => 'om_collectivite', |
258 |
'type' => 'select', |
259 |
'libelle' => _('om_collectivite') |
260 |
); |
261 |
} |
262 |
// advsearch -> options |
263 |
$options[] = array( |
264 |
'type' => 'search', |
265 |
'display' => true, |
266 |
'advanced' => $champs, |
267 |
'default_form' => 'advanced', |
268 |
'absolute_object' => 'dossier', |
269 |
'export' => array("csv"), |
270 |
); |
271 |
|
272 |
/** |
273 |
* OPTIONS |
274 |
*/ |
275 |
// |
276 |
$options[] = array( |
277 |
'type' => 'pagination_select', |
278 |
'display' => '' |
279 |
); |
280 |
} |
281 |
|
282 |
$retourformulaire = (isset($_GET['retourformulaire']) ? $_GET['retourformulaire'] : ""); |
283 |
|
284 |
// On change l'ordre d'affichage des onglets |
285 |
$sousformulaire=array(); |
286 |
$sousformulaire[] = "dossier_contrainte"; |
287 |
$sousformulaire[] = "instruction"; |
288 |
$sousformulaire[] = "consultation"; |
289 |
$sousformulaire[] = "dossier_commission"; |
290 |
$sousformulaire[] = "lot"; |
291 |
$sousformulaire[] = "dossier_message"; |
292 |
$sousformulaire[] = "blocnote"; |
293 |
// |
294 |
if ($f->isAccredited("document_numerise") || $f->isAccredited("dossier_document_numerise")) { |
295 |
$sousformulaire[] = "document_numerise"; |
296 |
} |
297 |
$sousformulaire[] = "dossier_autorisation"; |
298 |
|
299 |
/*Ajout de paramètre à certains sous-formulaire*/ |
300 |
$sousformulaire_parameters = array( |
301 |
"consultation" => array( |
302 |
"title" => _("consultation(s)"), |
303 |
), |
304 |
"dossier_message" => array( |
305 |
"title" => _("message(s)"), |
306 |
), |
307 |
"dossier_commission" => array( |
308 |
"title" => _("commission(s)"), |
309 |
), |
310 |
"lot" => array( |
311 |
"title" => _("lot(s)"), |
312 |
), |
313 |
"dossier_autorisation" => array( |
314 |
"title" => _("DA"), |
315 |
"href" => "../app/display_da_di.php?iddi=".((isset($idx))? $idx:""). |
316 |
"&retourformulaire=".$retourformulaire."&", |
317 |
), |
318 |
); |
319 |
|
320 |
// On modifie le lien du paramètre dossier_contrainte |
321 |
$sousformulaire_parameters["dossier_contrainte"] = array( |
322 |
"title" => _("Contrainte(s)"), |
323 |
"href" => "../scr/form.php?obj=dossier&action=4&idx=".((isset($idx))?$idx:"")."&retourformulaire=".((isset($_GET['obj']))?$_GET['obj']:"")."&", |
324 |
); |
325 |
|
326 |
// |
327 |
$sousformulaire_parameters["document_numerise"] = null; |
328 |
// |
329 |
if ($f->isAccredited("document_numerise") || $f->isAccredited("dossier_document_numerise")) { |
330 |
// |
331 |
$sousformulaire_parameters["document_numerise"] = array( |
332 |
"title" => _("Piece(s)"), |
333 |
"href" => "../scr/form.php?obj=dossier&action=5&idx=".((isset($idx))?$idx:"")."&retourformulaire=".((isset($_GET['obj']))?$_GET['obj']:"")."&", |
334 |
); |
335 |
} |
336 |
|
337 |
?> |