1 |
fmichon |
1022 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 07/12/2012 17:34 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/dossier_commission.class.php"); |
6 |
|
|
|
7 |
|
|
class dossier_commission extends dossier_commission_gen { |
8 |
|
|
|
9 |
|
|
function dossier_commission($id,&$db,$debug) { |
10 |
|
|
$this->constructeur($id,$db,$debug); |
11 |
|
|
}// fin constructeur |
12 |
|
|
|
13 |
fmichon |
1744 |
// {{{ Gestion de la confidentialité des données spécifiques |
14 |
|
|
|
15 |
|
|
/** |
16 |
|
|
* Surcharge pour gérer les actions disponibles dans le portlet |
17 |
|
|
*/ |
18 |
|
|
function checkAccessibility() { |
19 |
|
|
// |
20 |
|
|
parent::checkAccessibility(); |
21 |
|
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
22 |
|
|
// division du dossier |
23 |
|
|
if ($this->f->isUserInstructeur() |
24 |
|
|
&& isset($this->f->om_utilisateur["division"]) |
25 |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
26 |
|
|
// |
27 |
|
|
$this->actions_sup = array(); |
28 |
|
|
$this->setParameter("actions", array()); |
29 |
|
|
} |
30 |
|
|
// Si une action 'lu' est présente et que le champ lu est à true |
31 |
|
|
// on supprime l'action |
32 |
|
|
if (isset($this->actions_sup["lu"]) |
33 |
|
|
&& isset($this->val[array_search("lu", $this->champs)]) |
34 |
|
|
&& $this->val[array_search("lu", $this->champs)]== "t") { |
35 |
|
|
unset($this->actions_sup["lu"]); |
36 |
|
|
} |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
/** |
40 |
|
|
* Cette méthode permet de récupérer la division d'un dossier |
41 |
|
|
*/ |
42 |
|
|
function getDivisionFromDossier() { |
43 |
|
|
// Si on se trouve en mode MODIFIER ou SUPPRIMER ou CONSULTER alors on |
44 |
|
|
// récupère le numéro de dossier dans la consultation et on en retourne |
45 |
|
|
// sa division |
46 |
|
|
if ($this->getParameter("maj") == 1 || $this->getParameter("maj") == 2 |
47 |
|
|
|| $this->getParameter("maj") == 3) { |
48 |
|
|
// |
49 |
|
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
50 |
|
|
return NULL; |
51 |
|
|
} |
52 |
|
|
// |
53 |
|
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
54 |
|
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
55 |
|
|
// |
56 |
|
|
$division = $this->db->getOne($sql); |
57 |
|
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
58 |
|
|
database::isError($division); |
59 |
|
|
// |
60 |
|
|
return $division; |
61 |
|
|
} elseif ($this->getParameter("maj") == 0 |
62 |
|
|
&& ($this->getParameter("retourformulaire") == "dossier" |
63 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
64 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
65 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
66 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
67 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
68 |
|
|
// Si on se trouve en mode AJOUTER et en sous formulaire alors on |
69 |
|
|
// récupère le numéro de dossier dans les paramètres de sous |
70 |
|
|
// formulaires et on en retourne sa division |
71 |
|
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
72 |
|
|
$sql .= " where dossier='".$this->getParameter("idxformulaire")."'"; |
73 |
|
|
// |
74 |
|
|
$division = $this->db->getOne($sql); |
75 |
|
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
76 |
|
|
database::isError($division); |
77 |
|
|
// |
78 |
|
|
return $division; |
79 |
|
|
} else { |
80 |
|
|
return NULL; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
// }}} |
86 |
|
|
|
87 |
fmichon |
1332 |
function setType(&$form,$maj) { |
88 |
|
|
parent::setType($form, $maj); |
89 |
vpihour |
1401 |
|
90 |
|
|
//En ajout ou modification pour l'instructeur |
91 |
|
|
if ( $maj < 2 && |
92 |
|
|
( |
93 |
|
|
$this->retourformulaire=='dossier' |
94 |
fmichon |
1332 |
|| $this->retourformulaire=='dossier_instruction' |
95 |
|
|
|| $this->retourformulaire=='dossier_instruction_mes_encours' |
96 |
|
|
|| $this->retourformulaire=='dossier_instruction_tous_encours' |
97 |
|
|
|| $this->retourformulaire=='dossier_instruction_mes_clotures' |
98 |
|
|
|| $this->retourformulaire=='dossier_instruction_tous_clotures' |
99 |
vpihour |
1401 |
) ){ |
100 |
|
|
|
101 |
fmichon |
1332 |
$form->setType('dossier','hiddenstatic'); |
102 |
vpihour |
1401 |
$form->setType('commission','hidden'); |
103 |
|
|
$form->setType('avis','hidden'); |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
// En consultation et modification pour la cellule suivi |
107 |
|
|
if ( $maj == 1 && $this->retourformulaire == 'commission'){ |
108 |
|
|
|
109 |
fmichon |
1332 |
$form->setType('dossier','hiddenstatic'); |
110 |
vpihour |
1401 |
$form->setType('commission_type','hiddenstatic'); |
111 |
fmichon |
1552 |
$form->setType('date_souhaitee','hiddenstaticdate'); |
112 |
vpihour |
1401 |
$form->setType('motivation','hiddenstatic'); |
113 |
|
|
$form->setType('commission','hiddenstatic'); |
114 |
|
|
$form->setType('lu','hidden'); |
115 |
|
|
} |
116 |
|
|
|
117 |
|
|
if ( $maj == 3 && $this->retourformulaire == 'commission'){ |
118 |
|
|
|
119 |
|
|
$form->setType('lu','hidden'); |
120 |
|
|
} |
121 |
fmichon |
1732 |
// |
122 |
|
|
if ($this->getParameter("retourformulaire") == "dossier" |
123 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
124 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
125 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
126 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
127 |
|
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
128 |
|
|
// |
129 |
|
|
$form->setType('dossier', 'hidden'); |
130 |
|
|
} |
131 |
fmichon |
1332 |
} |
132 |
|
|
|
133 |
fmichon |
1732 |
|
134 |
|
|
function setLib(&$form, $maj) { |
135 |
|
|
// |
136 |
|
|
parent::setLib($form, $maj); |
137 |
|
|
// |
138 |
|
|
$form->setLib($this->clePrimaire, _("id")); |
139 |
|
|
} |
140 |
|
|
|
141 |
vpihour |
1401 |
// la demande de commission est mis à lu par défaut |
142 |
|
|
function triggerajouter($id,&$db,$val,$DEBUG) { |
143 |
|
|
|
144 |
|
|
$this->valF['lu'] = TRUE; |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
// Si la commission rend son avis, la demande de commission est non lu pour que |
148 |
|
|
// l'instructeur soit notifié |
149 |
|
|
function triggermodifier($id,&$db,$val,$DEBUG) { |
150 |
|
|
|
151 |
|
|
if ( $val['avis'] != "" ){ |
152 |
|
|
|
153 |
|
|
$this->valF['lu'] = FALSE; |
154 |
|
|
} |
155 |
|
|
} |
156 |
|
|
|
157 |
|
|
// Met la date au bon format |
158 |
fmichon |
1332 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
159 |
fmichon |
1494 |
// |
160 |
fmichon |
1332 |
$this->retourformulaire = $retourformulaire; |
161 |
fmichon |
1494 |
// En mode AJOUTER |
162 |
|
|
if ($maj == 0) { |
163 |
|
|
// On positionne la date du jour par défaut |
164 |
|
|
$form->setVal('date_souhaitee', date("d/m/Y")); |
165 |
|
|
// Afficher le numéro de dossier d'instruction |
166 |
fmichon |
1332 |
if($retourformulaire =='dossier' |
167 |
|
|
|| $retourformulaire =='dossier_instruction' |
168 |
|
|
|| $retourformulaire =='dossier_instruction_mes_encours' |
169 |
|
|
|| $retourformulaire =='dossier_instruction_tous_encours' |
170 |
|
|
|| $retourformulaire =='dossier_instruction_mes_clotures' |
171 |
vpihour |
1401 |
|| $retourformulaire =='dossier_instruction_tous_clotures'){ |
172 |
fmichon |
1332 |
$form->setVal('dossier', $idxformulaire); |
173 |
vpihour |
1401 |
} |
174 |
|
|
} |
175 |
|
|
} |
176 |
fmichon |
1332 |
|
177 |
vpihour |
1401 |
//Surcharge du bouton retour de la gestion des commissions afin de retourner directement vers le tableau |
178 |
|
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
179 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
180 |
|
|
$idx, $maj, $retour) { |
181 |
|
|
|
182 |
|
|
if( $maj = 1 && $retourformulaire === "commission") { |
183 |
|
|
|
184 |
|
|
echo "\n<a class=\"retour\" "; |
185 |
|
|
echo "href=\"#\" "; |
186 |
|
|
|
187 |
|
|
echo "onclick=\"ajaxIt('".$objsf."', '"; |
188 |
|
|
echo "../scr/soustab.php?obj=dossier_commission&idxformulaire=" |
189 |
|
|
.$val['commission']. |
190 |
|
|
"&retourformulaire=commission');\""; |
191 |
|
|
echo "\" "; |
192 |
|
|
echo ">"; |
193 |
|
|
// |
194 |
|
|
echo _("Retour"); |
195 |
|
|
// |
196 |
|
|
echo "</a>\n"; |
197 |
|
|
|
198 |
|
|
} else { |
199 |
|
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
200 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
201 |
|
|
$idx, $maj, $retour); |
202 |
|
|
} |
203 |
|
|
} |
204 |
fmichon |
1022 |
}// fin classe |
205 |
|
|
?> |