29 |
|
|
30 |
/*Formatage de l'adresse du terrain, concatenantion de plusieurs champs pour les |
/*Formatage de l'adresse du terrain, concatenantion de plusieurs champs pour les |
31 |
* mettrent dans une seule colonne*/ |
* mettrent dans une seule colonne*/ |
32 |
$trim_concat_terrain ='TRIM(CONCAT(dossier.terrain_adresse_voie_numero,\' \', |
$trim_concat_terrain = ' |
33 |
dossier.terrain_adresse_voie,\' \', |
TRIM( |
34 |
dossier.terrain_adresse_lieu_dit,\' \', |
COALESCE( |
35 |
dossier.terrain_adresse_code_postal,\' \', |
dossier.adresse_normalisee, |
36 |
dossier.terrain_adresse_localite,\' \', |
CONCAT_WS( |
37 |
dossier.terrain_adresse_bp,\' \', |
\' \', |
38 |
dossier.terrain_adresse_cedex |
dossier.terrain_adresse_voie_numero, |
39 |
)) as "'._("localisation").'"'; |
dossier.terrain_adresse_voie, |
40 |
|
dossier.terrain_adresse_lieu_dit, |
41 |
|
dossier.terrain_adresse_code_postal, |
42 |
|
dossier.terrain_adresse_localite, |
43 |
|
dossier.terrain_adresse_bp, |
44 |
|
dossier.terrain_adresse_cedex |
45 |
|
) |
46 |
|
) |
47 |
|
) as "'.__("localisation").'"'; |
48 |
|
|
49 |
/*Tables sur lesquels la requête va s'effectuer*/ |
/*Tables sur lesquels la requête va s'effectuer*/ |
50 |
$table = DB_PREFIXE."dossier |
$table = DB_PREFIXE."dossier |
80 |
LEFT OUTER JOIN ".DB_PREFIXE."arrondissement |
LEFT OUTER JOIN ".DB_PREFIXE."arrondissement |
81 |
ON arrondissement.code_postal = dossier.terrain_adresse_code_postal |
ON arrondissement.code_postal = dossier.terrain_adresse_code_postal |
82 |
"; |
"; |
83 |
|
if ($f->is_option_dossier_commune_enabled()) { |
84 |
|
$table .= " |
85 |
|
LEFT OUTER JOIN ".DB_PREFIXE."commune |
86 |
|
ON commune.commune = dossier.commune |
87 |
|
"; |
88 |
|
} |
89 |
|
|
90 |
|
// Ajout des colonnes concernant la demat |
91 |
|
$table .= |
92 |
|
"LEFT JOIN |
93 |
|
(SELECT |
94 |
|
dossier, |
95 |
|
external_uid |
96 |
|
FROM |
97 |
|
".DB_PREFIXE."lien_id_interne_uid_externe |
98 |
|
WHERE object = 'dossier' |
99 |
|
AND category = 'platau' |
100 |
|
) AS dossier_platau |
101 |
|
ON |
102 |
|
dossier_platau.dossier = dossier.dossier |
103 |
|
LEFT JOIN |
104 |
|
(SELECT |
105 |
|
dossier, |
106 |
|
external_uid |
107 |
|
FROM |
108 |
|
".DB_PREFIXE."lien_id_interne_uid_externe |
109 |
|
WHERE object = 'dossier_consultation' |
110 |
|
AND category = 'platau' |
111 |
|
) AS consultation_platau |
112 |
|
ON |
113 |
|
consultation_platau.dossier = dossier.dossier |
114 |
|
LEFT JOIN |
115 |
|
(SELECT |
116 |
|
dossier, |
117 |
|
ARRAY_TO_STRING(ARRAY_AGG(external_uid ORDER BY external_uid ASC), ', ') AS external_uid |
118 |
|
FROM |
119 |
|
".DB_PREFIXE."lien_id_interne_uid_externe |
120 |
|
WHERE |
121 |
|
object = 'piece' |
122 |
|
AND category = 'platau' |
123 |
|
GROUP BY |
124 |
|
dossier) AS pieces_platau |
125 |
|
ON |
126 |
|
pieces_platau.dossier = dossier.dossier |
127 |
|
LEFT JOIN |
128 |
|
(SELECT |
129 |
|
dossier, |
130 |
|
ARRAY_TO_STRING(ARRAY_AGG(object || ' : ' || external_uid), ', ') AS external_uid |
131 |
|
FROM |
132 |
|
".DB_PREFIXE."lien_id_interne_uid_externe |
133 |
|
WHERE |
134 |
|
object != 'piece' |
135 |
|
AND object != 'dossier' |
136 |
|
AND object != 'dossier_consultation' |
137 |
|
AND category = 'platau' |
138 |
|
GROUP BY |
139 |
|
dossier) AS autres_platau |
140 |
|
ON |
141 |
|
autres_platau.dossier = dossier.dossier |
142 |
|
LEFT JOIN |
143 |
|
(SELECT DISTINCT(dossier_instruction), source_depot |
144 |
|
FROM ".DB_PREFIXE."demande) AS demande |
145 |
|
ON demande.dossier_instruction = dossier.dossier |
146 |
|
"; |
147 |
|
|
148 |
|
$champ_date_depot_mairie = 'to_char(dossier.date_depot_mairie ,\'DD/MM/YYYY\') as "'._("date_depot_mairie").'"'; |
149 |
|
|
150 |
/*Champs du début de la requête*/ |
/*Champs du début de la requête*/ |
151 |
$champAffiche_debut_commun = array( |
$champAffiche_debut_commun = array( |
152 |
'dossier.dossier as "'._("dossier").'"', |
'dossier.dossier as "'._("dossier").'"', |
153 |
'dossier.dossier_libelle as "'._("dossier").'"', |
'dossier.dossier_libelle as "'._("dossier").'"' |
154 |
|
); |
155 |
|
if ($f->is_option_dossier_commune_enabled()) { |
156 |
|
$champAffiche_debut_commun[] = 'commune.libelle as "'.__("commune").'"'; |
157 |
|
} |
158 |
|
array_push($champAffiche_debut_commun, |
159 |
$case_demandeur.' as "'._("petitionnaire").'"', |
$case_demandeur.' as "'._("petitionnaire").'"', |
160 |
$trim_concat_terrain, |
$trim_concat_terrain, |
161 |
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"', |
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"', |
164 |
'CASE WHEN dossier.incomplet_notifie IS TRUE AND dossier.incompletude IS TRUE |
'CASE WHEN dossier.incomplet_notifie IS TRUE AND dossier.incompletude IS TRUE |
165 |
THEN to_char(dossier.date_limite_incompletude ,\'DD/MM/YYYY\') |
THEN to_char(dossier.date_limite_incompletude ,\'DD/MM/YYYY\') |
166 |
ELSE to_char(dossier.date_limite ,\'DD/MM/YYYY\') |
ELSE to_char(dossier.date_limite ,\'DD/MM/YYYY\') |
167 |
END as "'._("date_limite").'"', |
END as "'._("date_limite").'"' |
168 |
); |
); |
169 |
|
|
170 |
|
if ($f->is_option_date_depot_mairie_enabled() === true) { |
171 |
|
$champAffiche_debut_commun[] = $champ_date_depot_mairie; |
172 |
|
} |
173 |
/** |
/** |
174 |
* Colonne "Nature des travaux" (regroupe les descriptions des données |
* Colonne "Nature des travaux" (regroupe les descriptions des données |
175 |
* techniques). |
* techniques). |
192 |
replace(left(nature_des_travaux, ".$max_chars."), '\n', '<br/>') || '…', |
replace(left(nature_des_travaux, ".$max_chars."), '\n', '<br/>') || '…', |
193 |
'</span>') |
'</span>') |
194 |
END as \""._("nature des travaux").'"'; |
END as \""._("nature des travaux").'"'; |
195 |
// |
// description/nature des travaux. En cas de modif, bloc de code aussi présent dans |
196 |
|
// dossier.form.inc.php (le formulaire du DI)', 'om_requete' et 'stats à la demande' |
197 |
$nature_des_travaux_from = " |
$nature_des_travaux_from = " |
198 |
INNER JOIN ( |
INNER JOIN ( |
199 |
SELECT |
SELECT |
|
-- description/nature des travaux. En cas de modif, bloc de code aussi |
|
|
-- présent dans 'dossier.form.inc.php (le formulaire du DI)' |
|
|
-- 'om_requete' et 'stats à la demande'. |
|
200 |
CONCAT_WS( |
CONCAT_WS( |
201 |
'\n', |
'\n', |
202 |
CASE WHEN co_projet_desc = '' THEN |
CASE WHEN co_projet_desc = '' THEN |
250 |
// Modifie les colonnes à afficher en début du tableau |
// Modifie les colonnes à afficher en début du tableau |
251 |
$champAffiche_debut_commun = array( |
$champAffiche_debut_commun = array( |
252 |
'dossier.dossier as "'._("dossier").'"', |
'dossier.dossier as "'._("dossier").'"', |
253 |
'dossier.dossier_libelle as "'._("dossier").'"', |
'dossier.dossier_libelle as "'._("dossier").'"' |
254 |
|
); |
255 |
|
if ($f->is_option_dossier_commune_enabled()) { |
256 |
|
$champAffiche_debut_commun[] = 'commune.libelle as "'.__("commune").'"'; |
257 |
|
} |
258 |
|
array_push($champAffiche_debut_commun, |
259 |
$case_demandeur.' as "'._("petitionnaire").'"', |
$case_demandeur.' as "'._("petitionnaire").'"', |
260 |
$trim_concat_terrain, |
$trim_concat_terrain, |
261 |
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"', |
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"', |
265 |
'CASE WHEN dossier.incomplet_notifie IS TRUE AND dossier.incompletude IS TRUE |
'CASE WHEN dossier.incomplet_notifie IS TRUE AND dossier.incompletude IS TRUE |
266 |
THEN to_char(dossier.date_limite_incompletude ,\'DD/MM/YYYY\') |
THEN to_char(dossier.date_limite_incompletude ,\'DD/MM/YYYY\') |
267 |
ELSE to_char(dossier.date_limite ,\'DD/MM/YYYY\') |
ELSE to_char(dossier.date_limite ,\'DD/MM/YYYY\') |
268 |
END as "'._("date_limite").'"', |
END as "'._("date_limite").'"' |
269 |
); |
); |
270 |
|
if ($f->is_option_date_depot_mairie_enabled() === true) { |
271 |
|
$champAffiche_debut_commun[] = $champ_date_depot_mairie; |
272 |
|
} |
273 |
// Modifie également le from |
// Modifie également le from |
274 |
$table .= $nature_des_travaux_from; |
$table .= $nature_des_travaux_from; |
275 |
} |
} |
308 |
// dossiers d'instruction |
// dossiers d'instruction |
309 |
$tab_actions['corner']['ajouter'] = NULL; |
$tab_actions['corner']['ajouter'] = NULL; |
310 |
|
|
311 |
|
if (isset($_GET['message_help']) |
312 |
|
&& ! is_null($_GET['message_help']) |
313 |
|
&& $_GET['message_help'] != "" |
314 |
|
&& $_GET['module'] == 'tab') { |
315 |
|
|
316 |
|
$tab_actions['left']["consulter"]['id'] .= '&message_help='.urlencode($_GET['message_help']); |
317 |
|
$tab_actions['content'] = $tab_actions['left']["consulter"]; |
318 |
|
} |
319 |
|
|
320 |
// Liste des autres dossiers d'instructions |
// Liste des autres dossiers d'instructions |
321 |
if ($retourformulaire== 'dossier_instruction'){ |
if ($retourformulaire== 'dossier_instruction'){ |
322 |
$champAffiche=array( |
$champAffiche = array( |
323 |
'b.dossier as "'._("dossier_instruction").'"', |
'b.dossier as "'._("dossier_instruction").'"', |
324 |
'b.dossier_libelle as "'._("dossier").'"', |
'b.dossier_libelle as "'._("dossier").'"' |
325 |
|
); |
326 |
|
if ($f->is_option_dossier_commune_enabled()) { |
327 |
|
$champAffiche[] = 'c.libelle as "'._("commune").'"'; |
328 |
|
} |
329 |
|
array_push($champAffiche, |
330 |
'dossier_instruction_type.libelle as "'._("demande_type").'"', |
'dossier_instruction_type.libelle as "'._("demande_type").'"', |
331 |
'to_char(b.date_depot ,\'DD/MM/YYYY\') as "'._("date_depot").'"', |
'to_char(b.date_depot ,\'DD/MM/YYYY\') as "'._("date_depot").'"', |
332 |
'b.etat as "'._("etat").'"', |
'b.etat as "'._("etat").'"' |
333 |
); |
); |
334 |
|
|
335 |
$table =DB_PREFIXE.'dossier as a |
$table =DB_PREFIXE.'dossier as a |
339 |
ON b.dossier_autorisation=dossier_autorisation.dossier_autorisation |
ON b.dossier_autorisation=dossier_autorisation.dossier_autorisation |
340 |
JOIN '.DB_PREFIXE.'dossier_instruction_type |
JOIN '.DB_PREFIXE.'dossier_instruction_type |
341 |
ON dossier_instruction_type.dossier_instruction_type = b.dossier_instruction_type'; |
ON dossier_instruction_type.dossier_instruction_type = b.dossier_instruction_type'; |
342 |
$selection = 'WHERE a.dossier=\''.$idx.'\''; |
if ($f->is_option_dossier_commune_enabled()) { |
343 |
|
$table .= ' |
344 |
|
JOIN '.DB_PREFIXE.'commune as c |
345 |
|
ON c.commune = dossier.commune'; |
346 |
|
} |
347 |
|
$selection = 'WHERE a.dossier=\''.$f->db->escapeSimple($idxformulaire).'\''; |
348 |
$tri= "order by b.date_depot ASC"; |
$tri= "order by b.date_depot ASC"; |
349 |
|
|
350 |
// |
// |
390 |
'ajax' => false); |
'ajax' => false); |
391 |
} |
} |
392 |
|
|
|
/*Paramétrage des actions du portlet*/ |
|
|
$portlet_actions['modifier'] = array('lien' => "".OM_ROUTE_FORM."&obj=dossier_instruction&action=1&idx=", |
|
|
'id' => "&premier=0&advs_id=&tricol=-0&valide=&retour=form&retourformulaire=".$obj."&retourformulaire2=".$retourformulaire, |
|
|
'lib' => "<span class=\"om-prev-icon om-icon-16 edit-16\" title=\"". |
|
|
_("Modifier")."\">"._("Modifier")."</span>", |
|
|
'ordre' => 10, |
|
|
'rights' => array('list' => array("dossier_instruction_mes_encours_modifier", "dossier_instruction_tous_encours_modifier", "dossier_instruction_mes_clotures_modifier", "dossier_instruction_tous_clotures_modifier", "dossier_instruction_modifier", |
|
|
"dossier_contentieux_mes_infraction", "dossier_contentieux_toutes_infraction"), 'operator' => 'OR'), |
|
|
'ajax' => false); |
|
|
|
|
|
$portlet_actions['supprimer'] = array('lien' => "".OM_ROUTE_FORM."&obj=dossier_instruction&action=2&idx=", |
|
|
'id' => "&premier=0&advs_id=&tricol=-0&valide=&retour=form&retourformulaire=".$obj."&retourformulaire2=".$retourformulaire, |
|
|
'lib' => "<span class=\"om-prev-icon om-icon-16 delete-16\" title=\"". |
|
|
_("Supprimer")."\">"._("Supprimer")."</span>", |
|
|
'ordre' => 28, |
|
|
'rights' => array('list' => array("dossier_instruction_mes_encours_supprimer", "dossier_instruction_tous_encours_supprimer", "dossier_instruction_mes_clotures_supprimer", "dossier_instruction_tous_clotures_supprimer", "dossier_instruction_supprimer", |
|
|
"dossier_contentieux_mes_infraction", "dossier_contentieux_toutes_infraction"), 'operator' => 'OR'), |
|
|
'ajax' => false); |
|
|
|
|
393 |
// Si filtre DI auxquels on peut proposer une autre décision |
// Si filtre DI auxquels on peut proposer une autre décision |
394 |
if (isset($extra_parameters["filtre_decision"]) |
if (isset($extra_parameters["filtre_decision"]) |
395 |
&& $extra_parameters["filtre_decision"] == true) { |
&& $extra_parameters["filtre_decision"] == true) { |
441 |
// Gestion des groupes et confidentialité |
// Gestion des groupes et confidentialité |
442 |
include ('../sql/pgsql/filter_group.inc.php'); |
include ('../sql/pgsql/filter_group.inc.php'); |
443 |
|
|
|
?> |
|
444 |
|
?> |