1 |
<?php |
2 |
//$Id$ |
3 |
|
4 |
include('../gen/sql/pgsql/consultation.inc.php'); |
5 |
|
6 |
// |
7 |
$case_type_consultation = 'CASE WHEN service.type_consultation=\'avec_avis_attendu\' |
8 |
THEN \''._("avec avis attendu").'\' |
9 |
WHEN service.type_consultation=\'pour_conformite\' |
10 |
THEN \''._("pour conformite").'\' |
11 |
WHEN service.type_consultation=\'pour_information\' |
12 |
THEN \''._("pour information").'\' |
13 |
END'; |
14 |
$case_consultation_lu = "case consultation.lu when 't' then 'Oui' else 'Non' end"; |
15 |
// SELECT |
16 |
$champAffiche = array( |
17 |
'consultation.consultation as "'._("consultation").'"', |
18 |
'consultation.dossier as "'._("dossier").'"', |
19 |
'to_char(consultation.date_envoi ,\'DD/MM/YYYY\') as "'._("date_envoi").'"', |
20 |
'to_char(consultation.date_reception ,\'DD/MM/YYYY\') as "'._("date_reception").'"', |
21 |
'to_char(consultation.date_retour ,\'DD/MM/YYYY\') as "'._("date_retour").'"', |
22 |
'to_char(consultation.date_limite ,\'DD/MM/YYYY\') as "'._("date_limite").'"', |
23 |
'concat(service.abrege,\' \',service.libelle) as "'._("service").'"', |
24 |
$case_type_consultation.' as "'._("type_consultation").'"', |
25 |
'avis_consultation.libelle as "'._("avis_consultation").'"', |
26 |
'instructeur.nom as "'._("instructeur").'"', |
27 |
'division.code as "'._("division").'"', |
28 |
$case_consultation_lu." as \""._("lu")."\"", |
29 |
); |
30 |
|
31 |
$table .= " |
32 |
LEFT JOIN ".DB_PREFIXE."instructeur |
33 |
ON instructeur.instructeur=dossier.instructeur |
34 |
LEFT JOIN ".DB_PREFIXE."om_utilisateur |
35 |
ON instructeur.om_utilisateur = om_utilisateur.om_utilisateur |
36 |
LEFT JOIN ".DB_PREFIXE."division |
37 |
ON dossier.division=division.division"; |
38 |
|
39 |
/** |
40 |
* Gestion particulière de l'affichage du listing des consultations dans le |
41 |
* contexte d'un dossier d'instruction (pour un service consulté) |
42 |
*/ |
43 |
if ($retourformulaire == 'service') { |
44 |
// Actions en coin : ajouter |
45 |
$tab_actions['corner']['ajouter'] = NULL; |
46 |
// Actions a gauche : consulter |
47 |
$tab_actions['left']['consulter'] = NULL; |
48 |
$selection=" where consultation.service ='".$idx."'"; |
49 |
} |
50 |
|
51 |
/** |
52 |
* Gestion particulière de l'affichage du listing des consultations dans le |
53 |
* contexte d'un dossier d'instruction (pour l'instructeur) |
54 |
*/ |
55 |
if ($retourformulaire == 'dossier' |
56 |
OR $retourformulaire == 'dossier_instruction' |
57 |
OR $retourformulaire == 'dossier_instruction_mes_encours' |
58 |
OR $retourformulaire == 'dossier_instruction_tous_encours' |
59 |
OR $retourformulaire == 'dossier_instruction_mes_clotures' |
60 |
OR $retourformulaire == 'dossier_instruction_tous_clotures') { |
61 |
// |
62 |
$case_consultation_lu = "case when consultation.avis_consultation is null then '' |
63 |
else case consultation.lu |
64 |
when 't' then 'Oui' |
65 |
else 'Non' |
66 |
end |
67 |
end"; |
68 |
// SELECT |
69 |
$champAffiche = array( |
70 |
'consultation.consultation as "'._("consultation").'"', |
71 |
'to_char(consultation.date_envoi ,\'DD/MM/YYYY\') as "'._("date_envoi").'"', |
72 |
'to_char(consultation.date_reception ,\'DD/MM/YYYY\') as "'._("date_reception").'"', |
73 |
'to_char(consultation.date_retour ,\'DD/MM/YYYY\') as "'._("date_retour").'"', |
74 |
'to_char(consultation.date_limite ,\'DD/MM/YYYY\') as "'._("date_limite").'"', |
75 |
'service.libelle as "'._("service").'"', |
76 |
$case_type_consultation.' as "'._("type_consultation").'"', |
77 |
'avis_consultation.libelle as "'._("avis_consultation").'"', |
78 |
$case_consultation_lu." as \""._("lu")."\"", |
79 |
); |
80 |
// Filtre dur les données du dossier |
81 |
$selection=" WHERE (consultation.dossier ='".$idx."')"; |
82 |
// Ajout d'une action supplémentaire - ajout de consultations multiples |
83 |
$id=""; |
84 |
$lien = "../app/consultation_multiple.php?obj=$obj&idx=$idx&ret=$retourformulaire"; |
85 |
$right = array('list' => array($obj, $obj.'_ajouter'),'operator' => 'OR'); |
86 |
$tab_actions['corner']['ajouter_multiple'] = array ( |
87 |
'lien' => $lien, |
88 |
'id' => $id, |
89 |
'lib' => '<span class="om-icon om-icon-16 om-icon-fix mut-add-16" title="'._('Ajouter plusieurs').'">'._('Ajouter plusieurs').'</span>', |
90 |
'right' => $right, |
91 |
); |
92 |
// |
93 |
if (isset($f) && $f->isUserInstructeur() |
94 |
&& $f->getDivisionFromDossier($idx) != $_SESSION["division"]) { |
95 |
$tab_actions['corner'] = array(); |
96 |
} |
97 |
} |
98 |
|
99 |
/** |
100 |
* Options |
101 |
*/ |
102 |
// On affiche le champ lu en gras |
103 |
$options[] = array( |
104 |
"type" => "condition", |
105 |
"field" => $case_consultation_lu, |
106 |
"case" => array( |
107 |
"0" => array( |
108 |
"values" => array("Non", ), |
109 |
"style" => "non_lu", |
110 |
), |
111 |
), |
112 |
); |
113 |
/** |
114 |
* Options |
115 |
*/ |
116 |
// On met la ligne en couleur selon le type de condition |
117 |
$options[] = array( |
118 |
"type" => "condition", |
119 |
"field" => $case_type_consultation, |
120 |
"case" => array( |
121 |
array( |
122 |
"values" => array(_("avec avis attendu"), ), |
123 |
"style" => "consultation-avec-avis-attendu", |
124 |
), |
125 |
array( |
126 |
"values" => array(_("pour conformite"), ), |
127 |
"style" => "consultation-pour-conformite", |
128 |
), |
129 |
array( |
130 |
"values" => array(_("pour information"), ), |
131 |
"style" => "consultation-pour-information", |
132 |
), |
133 |
), |
134 |
); |
135 |
|
136 |
?> |