41 |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
42 |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
43 |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
44 |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"] ) |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"]) |
45 |
) { |
) { |
46 |
$this->valF["lu"]=false; |
$this->valF["lu"]=false; |
47 |
} |
} |
48 |
|
} |
49 |
|
|
50 |
|
function verifier($val, &$db, $DEBUG) { |
51 |
|
parent::verifier($val, $db, $DEBUG); |
52 |
// Si le fichier envoye est different de l'existant |
// Si le fichier envoye est different de l'existant |
53 |
if (isset($this->val[array_search("fichier",$this->champs)]) |
if (isset($this->val[array_search("fichier",$this->champs)]) |
54 |
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
70 |
// Sinon on supprime le fichier dans tmp |
// Sinon on supprime le fichier dans tmp |
71 |
// on reinitialise le nom du fichier a l'ancienne valeur |
// on reinitialise le nom du fichier a l'ancienne valeur |
72 |
} else { |
} else { |
73 |
|
$this->correct = false; |
74 |
$this->addToMessage($res); |
$this->addToMessage($res); |
75 |
unlink("../tmp/".$this->valF['fichier']); |
unlink("../tmp/".$this->valF['fichier']); |
76 |
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
80 |
} |
} |
81 |
|
|
82 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
83 |
|
// Appel du parent |
84 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
85 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
// MODE - AJOUTER |
86 |
if($maj==0){ // add |
if ($maj == 0) { |
87 |
$form->setType('dossier', 'hiddenstatic'); |
// On cache alors tous les champs que nous ne voulons pas voir |
88 |
$form->setType('date_envoi', 'date2'); |
// apparaître dans le formulaire d'ajout (principalement les |
89 |
$form->setType('service', 'select'); |
// informations sur le retour d'avis) |
90 |
$form->setType('date_limite', 'hidden'); |
$form->setType('date_retour', 'hidden'); |
91 |
$form->setType('date_retour', 'hidden'); |
$form->setType('date_reception', 'hidden'); |
92 |
$form->setType('avis_consultation', 'hidden'); |
$form->setType('date_limite', 'hidden'); |
93 |
$form->setType('motivation', 'hidden'); |
$form->setType('avis_consultation', 'hidden'); |
94 |
$form->setType('fichier', 'hidden'); |
$form->setType('motivation', 'hidden'); |
95 |
|
$form->setType('fichier', 'hidden'); |
96 |
|
$form->setType('lu', 'hidden'); |
97 |
|
// On permet la modification de certains champs |
98 |
|
$form->setType('dossier', 'hiddenstatic'); |
99 |
|
$form->setType('service', 'select'); |
100 |
|
$form->setType('date_envoi', 'date2'); |
101 |
|
} |
102 |
|
// MODE - MODIFIER |
103 |
|
if ($maj == 1) { |
104 |
|
|
105 |
|
// On affiche en statique les informations qui ne sont plus |
106 |
|
// modifiables |
107 |
|
$form->setType('dossier', 'hiddenstatic'); |
108 |
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
109 |
|
$form->setType('date_limite', 'hiddenstaticdate'); |
110 |
|
$form->setType('service', 'selecthiddenstatic'); |
111 |
|
|
112 |
|
// La date de réception ne peut être modifiée que par un |
113 |
|
// utilisateur en ayant spécifiquement la permission |
114 |
|
if($this->f->isAccredited('consultation_modifier_date_reception')) { |
115 |
|
$form->setType('date_reception', 'date2'); |
116 |
|
} else { |
117 |
|
$form->setType('date_reception', 'hiddenstaticdate'); |
118 |
|
} |
119 |
|
|
120 |
|
// Le marqueur lu/non lu ne peut être modifié que par un |
121 |
|
// utilisateur en ayant spécifiquement la permission |
122 |
|
if ($this->f->isAccredited('consultation_modifier_lu')) { |
123 |
|
$form->setType('lu', 'checkbox'); |
124 |
|
} else { |
125 |
$form->setType('lu', 'hidden'); |
$form->setType('lu', 'hidden'); |
126 |
|
} |
127 |
|
|
128 |
|
// Gestion du type du widget sur le champ fichier |
129 |
|
if($this->val[array_search("fichier",$this->champs)]=="" OR |
130 |
|
$this->f->isAccredited('consultation_modifier_fichier')) { |
131 |
|
// Si il n'y a jamais eu de fichier enregistré ou que |
132 |
|
// l'utilisateur a spécifiquement les droits pour modifier |
133 |
|
// un fichier déjà enregistré alors on positionne un type |
134 |
|
// de widget modifiable |
135 |
|
$form->setType('fichier', 'tmpUpload'); |
136 |
|
} else { |
137 |
|
// Si non on affiche uniquement le nom du fichier |
138 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
139 |
|
} |
140 |
|
|
141 |
|
// Modification layout : écran de retour d'avis permettant |
142 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
143 |
|
if (!$this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
144 |
|
|
145 |
|
// On cache alors tous les champs que nous ne voulons pas voir |
146 |
|
$form->setType('dossier', 'hidden'); |
147 |
|
$form->setType('service', 'hidden'); |
148 |
|
$form->setType('date_envoi', 'hidden'); |
149 |
|
$form->setType('date_retour', 'hidden'); |
150 |
$form->setType('date_reception', 'hidden'); |
$form->setType('date_reception', 'hidden'); |
151 |
}else{ // modify |
$form->setType('date_limite', 'hidden'); |
152 |
if($this->f->isAccredited('consultation_retour_avis_service')) { |
$form->setType('lu', 'hidden'); |
153 |
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('service', 'hidden'); |
|
|
$form->setType('date_envoi', 'hidden'); |
|
|
$form->setType('date_retour', 'hidden'); |
|
|
$form->setType('date_reception', 'hidden'); |
|
|
$form->setType('date_limite', 'hidden'); |
|
|
$form->setType('lu', 'hidden'); |
|
|
// Si il n'y a pas de fichier ou que l'utilisateur a les droits |
|
|
if($this->val[array_search("fichier",$this->champs)]=="" OR |
|
|
$this->f->isAccredited('consultation_modifier_fichier')) { |
|
|
$form->setType('fichier', 'tmpUpload'); |
|
|
} else { |
|
|
$form->setType('fichier', 'hiddenstatic'); |
|
|
} |
|
|
} else { |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
|
|
$form->setType('date_limite', 'hiddenstaticdate'); |
|
|
if(!$this->f->isAccredited('consultation_modifier_date_reception')) { |
|
|
$form->setType('date_reception', 'hiddenstaticdate'); |
|
|
} else { |
|
|
$form->setType('date_reception', 'date2'); |
|
|
} |
|
|
$form->setType('service', 'selecthiddenstatic'); |
|
|
$form->setType('date_retour', 'date2'); |
|
|
$form->setType('avis_consultation', 'select'); |
|
|
$form->setType('motivation', 'textarea'); |
|
|
// Si il n'y a pas de fichier ou que l'utilisateur a les droits |
|
|
if($this->val[array_search("fichier",$this->champs)]=="" OR |
|
|
$this->f->isAccredited('consultation_modifier_fichier')) { |
|
|
$form->setType('fichier', 'tmpUpload'); |
|
|
} else { |
|
|
$form->setType('fichier', 'hiddenstatic'); |
|
|
} |
|
|
//Affichage du champ en modification pour le prifil instructeur |
|
|
if(!$this->f->isAccredited('consultation_modifier_lu')) { |
|
|
$form->setType('lu', 'hidden'); |
|
|
} |
|
|
} |
|
154 |
} |
} |
|
} |
|
|
$form->setType('consultation', 'hidden'); |
|
|
//setType pour profil service |
|
155 |
|
|
156 |
|
} |
157 |
|
// MODE - CONSULTER |
158 |
|
if ( $maj == 3 ) { |
159 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
160 |
|
} |
161 |
|
//// On cache la clé primaire |
162 |
|
//$form->setType('consultation', 'hidden'); |
163 |
} |
} |
164 |
|
|
165 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// TRIGGER AVANT MODIFICATION DE DONNEES |
199 |
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
200 |
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
201 |
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
202 |
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('lien_interne_vdm'). |
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('services_consultes_lien_interne'). |
203 |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
204 |
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('lien_externe'). |
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('services_consultes_lien_externe'). |
205 |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
206 |
_("Lien externe (hors VDM)")."</a>"; |
_("Lien externe (hors VDM)")."</a>"; |
207 |
// Envoi du mail avec message de retour |
// Envoi du mail avec message de retour |
258 |
// Add fieldset |
// Add fieldset |
259 |
// ============================================= |
// ============================================= |
260 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
261 |
if ( $maj < 2 OR $maj == 3 ) { |
|
262 |
if(!$this->f->isAccredited('consultation_retour_avis_service')) { |
// Modification layout : écran de retour d'avis permettant |
263 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
264 |
|
if ($this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
265 |
|
|
266 |
//Champs sur lequel s'ouvre le fieldset |
//Champs sur lequel s'ouvre le fieldset |
267 |
$form->setBloc('dossier','D',""); |
$form->setBloc('dossier','D',""); |
268 |
$form->setFieldset('dossier','D',_('Consultation')); |
$form->setFieldset('dossier','D',_('Consultation')); |
270 |
//Champs sur lequel se ferme le fieldset |
//Champs sur lequel se ferme le fieldset |
271 |
$form->setFieldset('date_envoi','F',''); |
$form->setFieldset('date_envoi','F',''); |
272 |
$form->setBloc('date_envoi','F'); |
$form->setBloc('date_envoi','F'); |
273 |
|
|
274 |
} |
} |
275 |
if ( $maj == 1 OR $maj == 3 ){ |
|
276 |
|
// MODE - autre que AJOUTER alors on affiche un fieldset retour |
277 |
|
// d'avis |
278 |
|
if ($maj != 0) { |
279 |
|
|
280 |
//Champs sur lequel s'ouvre le fieldset |
//Champs sur lequel s'ouvre le fieldset |
281 |
$form->setBloc('date_reception','D',""); |
$form->setBloc('date_reception','D',""); |
282 |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
283 |
|
|
284 |
//Champs sur lequel se ferme le fieldset |
//Champs sur lequel se ferme le fieldset |
285 |
$form->setFieldset('lu','F',''); |
$form->setFieldset('lu','F',''); |
286 |
$form->setBloc('lu','F'); |
$form->setBloc('lu','F'); |
287 |
|
|
288 |
} |
} |
|
} |
|
289 |
} |
} |
290 |
|
|
291 |
/** Surcharge de la methode retour afin de retourner sur la page de saisie de |
/** Surcharge de la methode retour afin de retourner sur la page de saisie de |
321 |
echo _("Retour"); |
echo _("Retour"); |
322 |
// |
// |
323 |
echo "</a>\n"; |
echo "</a>\n"; |
|
|
|
324 |
} |
} |
325 |
|
|
326 |
|
/** |
327 |
|
* Méthode de verification d'accèssibilité de la consultation |
328 |
|
* à l'utilisateur connecté |
329 |
|
*/ |
330 |
|
function canAccess() { |
331 |
|
parent::canAccess(); |
332 |
|
if($this->f->isUserServiceExt()) { |
333 |
|
// On compare l'id du service de la consultation |
334 |
|
// aux id des services de utilisateur connecté |
335 |
|
foreach($this->f->om_utilisateur['service'] as $service) { |
336 |
|
if($this->val[array_search("service",$this->champs)]===$service['service']) { |
337 |
|
return true; |
338 |
|
} |
339 |
|
} |
340 |
|
return false; |
341 |
|
} |
342 |
|
} |
343 |
}// fin classe |
}// fin classe |
344 |
?> |
?> |