1 |
<?php |
2 |
/** |
3 |
* |
4 |
* |
5 |
* @package openfoncier |
6 |
* @version SVN : $Id$ |
7 |
*/ |
8 |
|
9 |
// |
10 |
include "../gen/sql/pgsql/evenement.form.inc.php"; |
11 |
|
12 |
// |
13 |
$sep = (isset($_GET['action']) && ($_GET['action'] == 1 || $_GET['action'] == 0 )) ? ';' : ',' ; |
14 |
|
15 |
// |
16 |
$champs = array( |
17 |
"evenement.evenement", |
18 |
"evenement.libelle", |
19 |
"evenement.type", |
20 |
"array_to_string(array_agg(transition.etat ORDER BY transition.etat), '$sep') as etats_depuis_lequel_l_evenement_est_disponible", |
21 |
"array_to_string(array_agg(dossier_instruction_type ORDER BY dossier_instruction_type), '$sep') as dossier_instruction_type", |
22 |
"evenement.restriction", |
23 |
"evenement.action", |
24 |
"evenement.etat", |
25 |
"evenement.delai", |
26 |
"evenement.accord_tacite", |
27 |
"evenement.delai_notification", |
28 |
"evenement.avis_decision", |
29 |
"evenement.lettretype", |
30 |
"evenement.consultation", |
31 |
"evenement.evenement_suivant_tacite", |
32 |
"evenement.evenement_retour_ar", |
33 |
); |
34 |
|
35 |
// |
36 |
$tableSelect = " |
37 |
".DB_PREFIXE."evenement |
38 |
LEFT JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
39 |
ON lien_dossier_instruction_type_evenement.evenement=evenement.evenement |
40 |
LEFT JOIN ".DB_PREFIXE."transition |
41 |
ON transition.evenement=evenement.evenement"; |
42 |
|
43 |
// |
44 |
$selection = " GROUP BY evenement.evenement, evenement.libelle "; |
45 |
|
46 |
// FKEY - OM_LETTRETYPE |
47 |
$sql_om_lettretype = " |
48 |
SELECT |
49 |
id, |
50 |
(id||' '||libelle) as lib |
51 |
FROM ".DB_PREFIXE."om_lettretype |
52 |
ORDER BY lib"; |
53 |
|
54 |
$sql_action="SELECT action.action, action.libelle as lib FROM ".DB_PREFIXE."action ORDER BY lib"; |
55 |
$sql_etat="SELECT etat.etat, etat.libelle as lib FROM ".DB_PREFIXE."etat ORDER BY lib"; |
56 |
$sql_avis_decision="SELECT avis_decision.avis_decision, avis_decision.libelle as lib FROM ".DB_PREFIXE."avis_decision ORDER BY lib"; |
57 |
$sql_evenement_retour_ar="SELECT evenement.evenement, evenement.libelle as lib FROM ".DB_PREFIXE."evenement ORDER BY lib"; |
58 |
$sql_evenement_suivant_tacite="SELECT evenement.evenement, evenement.libelle as lib FROM ".DB_PREFIXE."evenement ORDER BY lib"; |
59 |
|
60 |
// LIAISON NaN - DOSSIER_INSTRUCTION_TYPE (LIEN_DOSSIER_INSTRUCTION_TYPE_EVENEMENT) |
61 |
$sql_dossier_instruction_type = " |
62 |
SELECT |
63 |
dossier_instruction_type.dossier_instruction_type, |
64 |
CONCAT(dossier_autorisation_type_detaille.code,' - ',dossier_instruction_type.code,' - ',dossier_instruction_type.libelle) as lib |
65 |
FROM ".DB_PREFIXE."dossier_instruction_type |
66 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
67 |
ON dossier_instruction_type.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
68 |
ORDER BY dossier_autorisation_type_detaille.code"; |
69 |
$sql_dossier_instruction_type_by_id = " |
70 |
SELECT |
71 |
dossier_instruction_type.dossier_instruction_type, |
72 |
CONCAT(dossier_autorisation_type_detaille.code,' - ',dossier_instruction_type.code,' - ',dossier_instruction_type.libelle) as lib |
73 |
FROM ".DB_PREFIXE."dossier_instruction_type |
74 |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
75 |
ON dossier_instruction_type.dossier_autorisation_type_detaille=dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
76 |
WHERE dossier_instruction_type IN (<idx>) |
77 |
ORDER BY dossier_autorisation_type_detaille.code"; |
78 |
|
79 |
// LIAISON NaN - ETAT (TRANSITION) |
80 |
$sql_etats_depuis_lequel_l_evenement_est_disponible = " |
81 |
SELECT |
82 |
etat.etat, |
83 |
etat.libelle as lib |
84 |
FROM ".DB_PREFIXE."etat |
85 |
ORDER BY lib"; |
86 |
$sql_etats_depuis_lequel_l_evenement_est_disponible_by_id = " |
87 |
SELECT |
88 |
etat.etat, |
89 |
etat.libelle as lib |
90 |
FROM ".DB_PREFIXE."etat |
91 |
WHERE etat.etat IN (<idx>) |
92 |
ORDER BY lib"; |
93 |
|
94 |
?> |