1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 22/02/2023 11:40 |
4 |
|
5 |
$DEBUG=0; |
6 |
$serie=15; |
7 |
$ent = __("application")." -> ".__("consultation"); |
8 |
if(!isset($premier)) $premier=''; |
9 |
if(!isset($tricolsf)) $tricolsf=''; |
10 |
if(!isset($premiersf)) $premiersf=''; |
11 |
if(!isset($selection)) $selection=''; |
12 |
if(!isset($retourformulaire)) $retourformulaire=''; |
13 |
if (!isset($idxformulaire)) { |
14 |
$idxformulaire = ''; |
15 |
} |
16 |
if (!isset($tricol)) { |
17 |
$tricol = ''; |
18 |
} |
19 |
if (!isset($valide)) { |
20 |
$valide = ''; |
21 |
} |
22 |
// FROM |
23 |
$table = DB_PREFIXE."consultation |
24 |
LEFT JOIN ".DB_PREFIXE."avis_consultation |
25 |
ON consultation.avis_consultation=avis_consultation.avis_consultation |
26 |
LEFT JOIN ".DB_PREFIXE."categorie_tiers_consulte |
27 |
ON consultation.categorie_tiers_consulte=categorie_tiers_consulte.categorie_tiers_consulte |
28 |
LEFT JOIN ".DB_PREFIXE."dossier |
29 |
ON consultation.dossier=dossier.dossier |
30 |
LEFT JOIN ".DB_PREFIXE."motif_consultation |
31 |
ON consultation.motif_consultation=motif_consultation.motif_consultation |
32 |
LEFT JOIN ".DB_PREFIXE."service |
33 |
ON consultation.service=service.service |
34 |
LEFT JOIN ".DB_PREFIXE."tiers_consulte |
35 |
ON consultation.tiers_consulte=tiers_consulte.tiers_consulte "; |
36 |
// SELECT |
37 |
$champAffiche = array( |
38 |
'consultation.consultation as "'.__("consultation").'"', |
39 |
'dossier.annee as "'.__("dossier").'"', |
40 |
'to_char(consultation.date_envoi ,\'DD/MM/YYYY\') as "'.__("date_envoi").'"', |
41 |
'to_char(consultation.date_retour ,\'DD/MM/YYYY\') as "'.__("date_retour").'"', |
42 |
'to_char(consultation.date_limite ,\'DD/MM/YYYY\') as "'.__("date_limite").'"', |
43 |
'service.libelle as "'.__("service").'"', |
44 |
'avis_consultation.libelle as "'.__("avis_consultation").'"', |
45 |
'to_char(consultation.date_reception ,\'DD/MM/YYYY\') as "'.__("date_reception").'"', |
46 |
'consultation.fichier as "'.__("fichier").'"', |
47 |
"case consultation.lu when 't' then 'Oui' else 'Non' end as \"".__("lu")."\"", |
48 |
'consultation.code_barres as "'.__("code_barres").'"', |
49 |
'consultation.om_fichier_consultation as "'.__("om_fichier_consultation").'"', |
50 |
"case consultation.om_final_consultation when 't' then 'Oui' else 'Non' end as \"".__("om_final_consultation")."\"", |
51 |
"case consultation.marque when 't' then 'Oui' else 'Non' end as \"".__("marque")."\"", |
52 |
"case consultation.visible when 't' then 'Oui' else 'Non' end as \"".__("visible")."\"", |
53 |
"case consultation.om_fichier_consultation_dossier_final when 't' then 'Oui' else 'Non' end as \"".__("om_fichier_consultation_dossier_final")."\"", |
54 |
"case consultation.fichier_dossier_final when 't' then 'Oui' else 'Non' end as \"".__("fichier_dossier_final")."\"", |
55 |
'consultation.nom_auteur as "'.__("nom_auteur").'"', |
56 |
'consultation.prenom_auteur as "'.__("prenom_auteur").'"', |
57 |
'consultation.qualite_auteur as "'.__("qualite_auteur").'"', |
58 |
'categorie_tiers_consulte.libelle as "'.__("categorie_tiers_consulte").'"', |
59 |
'tiers_consulte.libelle as "'.__("tiers_consulte").'"', |
60 |
'motif_consultation.libelle as "'.__("motif_consultation").'"', |
61 |
'consultation.fichier_pec as "'.__("fichier_pec").'"', |
62 |
); |
63 |
// |
64 |
$champNonAffiche = array( |
65 |
'consultation.motivation as "'.__("motivation").'"', |
66 |
'consultation.texte_fondement_avis as "'.__("texte_fondement_avis").'"', |
67 |
'consultation.texte_avis as "'.__("texte_avis").'"', |
68 |
'consultation.texte_hypotheses as "'.__("texte_hypotheses").'"', |
69 |
'consultation.commentaire as "'.__("commentaire").'"', |
70 |
'consultation.motif_pec as "'.__("motif_pec").'"', |
71 |
); |
72 |
// |
73 |
$champRecherche = array( |
74 |
'consultation.consultation as "'.__("consultation").'"', |
75 |
'dossier.annee as "'.__("dossier").'"', |
76 |
'service.libelle as "'.__("service").'"', |
77 |
'avis_consultation.libelle as "'.__("avis_consultation").'"', |
78 |
'consultation.fichier as "'.__("fichier").'"', |
79 |
'consultation.code_barres as "'.__("code_barres").'"', |
80 |
'consultation.om_fichier_consultation as "'.__("om_fichier_consultation").'"', |
81 |
'consultation.nom_auteur as "'.__("nom_auteur").'"', |
82 |
'consultation.prenom_auteur as "'.__("prenom_auteur").'"', |
83 |
'consultation.qualite_auteur as "'.__("qualite_auteur").'"', |
84 |
'categorie_tiers_consulte.libelle as "'.__("categorie_tiers_consulte").'"', |
85 |
'tiers_consulte.libelle as "'.__("tiers_consulte").'"', |
86 |
'motif_consultation.libelle as "'.__("motif_consultation").'"', |
87 |
'consultation.fichier_pec as "'.__("fichier_pec").'"', |
88 |
); |
89 |
$tri="ORDER BY dossier.annee ASC NULLS LAST"; |
90 |
$edition="consultation"; |
91 |
/** |
92 |
* Gestion de la clause WHERE => $selection |
93 |
*/ |
94 |
// Filtre listing standard |
95 |
$selection = ""; |
96 |
// Liste des clés étrangères avec leurs éventuelles surcharges |
97 |
$foreign_keys_extended = array( |
98 |
"avis_consultation" => array("avis_consultation", ), |
99 |
"categorie_tiers_consulte" => array("categorie_tiers_consulte", ), |
100 |
"dossier" => array("dossier", "dossier_instruction", "dossier_instruction_mes_encours", "dossier_instruction_tous_encours", "dossier_instruction_mes_clotures", "dossier_instruction_tous_clotures", "dossier_contentieux", "dossier_contentieux_mes_infractions", "dossier_contentieux_toutes_infractions", "dossier_contentieux_mes_recours", "dossier_contentieux_tous_recours", "sous_dossier", ), |
101 |
"motif_consultation" => array("motif_consultation", ), |
102 |
"service" => array("service", ), |
103 |
"tiers_consulte" => array("tiers_consulte", ), |
104 |
); |
105 |
// Filtre listing sous formulaire - avis_consultation |
106 |
if (in_array($retourformulaire, $foreign_keys_extended["avis_consultation"])) { |
107 |
$selection = " WHERE (consultation.avis_consultation = ".intval($idxformulaire).") "; |
108 |
} |
109 |
// Filtre listing sous formulaire - categorie_tiers_consulte |
110 |
if (in_array($retourformulaire, $foreign_keys_extended["categorie_tiers_consulte"])) { |
111 |
$selection = " WHERE (consultation.categorie_tiers_consulte = ".intval($idxformulaire).") "; |
112 |
} |
113 |
// Filtre listing sous formulaire - dossier |
114 |
if (in_array($retourformulaire, $foreign_keys_extended["dossier"])) { |
115 |
$selection = " WHERE (consultation.dossier = '".$f->db->escapeSimple($idxformulaire)."') "; |
116 |
} |
117 |
// Filtre listing sous formulaire - motif_consultation |
118 |
if (in_array($retourformulaire, $foreign_keys_extended["motif_consultation"])) { |
119 |
$selection = " WHERE (consultation.motif_consultation = ".intval($idxformulaire).") "; |
120 |
} |
121 |
// Filtre listing sous formulaire - service |
122 |
if (in_array($retourformulaire, $foreign_keys_extended["service"])) { |
123 |
$selection = " WHERE (consultation.service = ".intval($idxformulaire).") "; |
124 |
} |
125 |
// Filtre listing sous formulaire - tiers_consulte |
126 |
if (in_array($retourformulaire, $foreign_keys_extended["tiers_consulte"])) { |
127 |
$selection = " WHERE (consultation.tiers_consulte = ".intval($idxformulaire).") "; |
128 |
} |
129 |
|