2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 10/02/2011 20:32 |
//gen openMairie le 10/02/2011 20:32 |
4 |
require_once ("../gen/obj/consultation.class.php"); |
require_once ("../gen/obj/consultation.class.php"); |
5 |
|
require_once("../services/outgoing/messageenqueuer.php"); |
6 |
|
|
7 |
class consultation extends consultation_gen { |
class consultation extends consultation_gen { |
8 |
|
|
9 |
function consultation($id,&$db,$debug) { |
function consultation($id,&$db,$debug) { |
10 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id,$db,$debug); |
11 |
}// fin constructeur |
}// fin constructeur |
12 |
|
|
13 |
function setValFAjout($val){ |
// {{{ Gestion de la confidentialité des données spécifiques |
14 |
$this->valF['service'] = $val['service']; |
|
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 methode est à surcharger elle permet de tester dans chaque classe |
41 |
|
* des droits des droits spécifiques en fonction des données |
42 |
|
*/ |
43 |
|
function canAccess() { |
44 |
|
// Si l'utilisateur est un utilisateur de service externe |
45 |
|
// on vérifie qu'il peut accéder à la consultation |
46 |
|
if ($this->f->isUserServiceExt()) { |
47 |
|
// On compare l'id du service de la consultation |
48 |
|
// aux id des services de utilisateur connecté |
49 |
|
foreach($this->f->om_utilisateur['service'] as $service) { |
50 |
|
if($this->val[array_search("service",$this->champs)]===$service['service']) { |
51 |
|
return true; |
52 |
|
} |
53 |
|
} |
54 |
|
// |
55 |
|
$this->f->addToLog("canAccess(): utilisateur de service sur une consultation d'un autre service", EXTRA_VERBOSE_MODE); |
56 |
|
return false; |
57 |
|
} |
58 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
59 |
|
// division du dossier |
60 |
|
if ($this->f->isUserInstructeur() |
61 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
62 |
|
&& $this->getParameter("maj") != 3) { |
63 |
|
// |
64 |
|
$this->f->addToLog("canAccess(): utilisateur instructeur sur un dossier d'une autre division", EXTRA_VERBOSE_MODE); |
65 |
|
return false; |
66 |
|
} |
67 |
|
// |
68 |
|
return true; |
69 |
} |
} |
70 |
|
|
71 |
function setvalF($val){ |
/** |
72 |
parent::setvalF($val); |
* Cette méthode permet de récupérer la division d'un dossier |
73 |
// cles secondaires numerique (contrainte integrite pgsql) |
*/ |
74 |
if($val['avis']=='') $this->valF['avis']= null; |
function getDivisionFromDossier() { |
75 |
} |
// Si on se trouve en mode MODIFIER ou SUPPRIMER ou CONSULTER alors on |
76 |
|
// récupère le numéro de dossier dans la consultation et on en retourne |
77 |
function verifier(){ |
// sa division |
78 |
$this->correct=True; |
if ($this->getParameter("maj") == 1 || $this->getParameter("maj") == 2 |
79 |
$imgv=""; |
|| $this->getParameter("maj") == 3) { |
80 |
$f=" ! "; |
// |
81 |
$imgv="<img src='../img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
82 |
if ($this->valF['service']==""){ |
return NULL; |
83 |
$this->correct=false; |
} |
84 |
$this->msg= $this->msg.$imgv." "._("service")." ". |
// |
85 |
_("obligatoire").$f; |
$sql = "select division from ".DB_PREFIXE."dossier "; |
86 |
} |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
87 |
if ($this->valF['dossier']==""){ |
// |
88 |
$this->correct=false; |
$division = $this->db->getOne($sql); |
89 |
$this->msg= $this->msg.$imgv." "._("dossier")." ". |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
90 |
_("obligatoire").$f; |
database::isError($division); |
91 |
} |
// |
92 |
if ($this->valF['date_envoi']==""){ |
return $division; |
93 |
$this->correct=false; |
} elseif ($this->getParameter("maj") == 0 |
94 |
$this->msg= $this->msg.$imgv." "._("date_envoi")." ". |
&& ($this->getParameter("retourformulaire") == "dossier" |
95 |
_("obligatoire").$f; |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
96 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
97 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
98 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
99 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
100 |
|
// Si on se trouve en mode AJOUTER et en sous formulaire alors on |
101 |
|
// récupère le numéro de dossier dans les paramètres de sous |
102 |
|
// formulaires et on en retourne sa division |
103 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
104 |
|
$sql .= " where dossier='".$this->getParameter("idxformulaire")."'"; |
105 |
|
// |
106 |
|
$division = $this->db->getOne($sql); |
107 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
108 |
|
database::isError($division); |
109 |
|
// |
110 |
|
return $division; |
111 |
|
} else { |
112 |
|
return NULL; |
113 |
} |
} |
114 |
|
|
115 |
} |
} |
116 |
|
|
117 |
|
// }}} |
118 |
|
|
119 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
120 |
if ($validation==0) { |
if ($validation==0) { |
121 |
if ($maj == 0){ |
if ($maj == 0){ |
122 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $idxformulaire); |
123 |
|
$form->setVal("date_envoi",date('d/m/Y')); |
124 |
} |
} |
125 |
|
if($maj == 1) { |
126 |
|
if($this->f->isAccredited('consultation_retour_avis_suivi') OR |
127 |
|
$this->f->isAccredited('consultation_retour_avis_service')) { |
128 |
|
$form->setVal("date_retour",date('d/m/Y')); |
129 |
|
} |
130 |
|
} |
131 |
|
} |
132 |
|
} |
133 |
|
|
134 |
|
function setVal(&$form, $maj, $validation, &$db) { |
135 |
|
if($maj == 1) { |
136 |
|
$form->setVal("date_retour",date('d/m/Y')); |
137 |
} |
} |
138 |
} |
} |
139 |
|
|
140 |
function setType(&$form,$maj) { |
function setvalF($val) { |
141 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
parent::setValF($val); |
142 |
if($maj==0){ // add |
if($this->getParameter('maj')==0) { |
143 |
$form->setType('date_envoi', 'date2'); |
$this->valF["date_reception"]=$this->valF["date_envoi"]; |
144 |
$form->setType('service', 'select'); |
} |
145 |
$form->setType('date_limite', 'hidden'); |
|
146 |
$form->setType('date_retour', 'hidden'); |
// Si un retour d'avis est modifie on passe "lu" a false |
147 |
$form->setType('avis', 'hidden'); |
if($this->getParameter('maj')==1 AND ( |
148 |
}else{ // modify |
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
149 |
$form->setType('date_envoi', 'hiddenstaticdate'); |
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
150 |
$form->setType('service', 'selectdisabled'); |
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
151 |
$form->setType('date_limite', 'date2'); |
$this->val[array_search("fichier",$this->champs)] != $val["fichier"]) |
152 |
$form->setType('date_retour', 'date2'); |
) { |
153 |
$form->setType('avis', 'select'); |
$this->valF["lu"]=false; |
154 |
|
} |
155 |
|
} |
156 |
|
|
157 |
|
function verifier($val, &$db, $DEBUG) { |
158 |
|
parent::verifier($val, $db, $DEBUG); |
159 |
|
// Si le fichier envoye est different de l'existant |
160 |
|
if (isset($this->val[array_search("fichier",$this->champs)]) |
161 |
|
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
162 |
|
&& $this->valF['fichier']!="") { |
163 |
|
// Si le fichier existe dans tmp |
164 |
|
if(file_exists("../tmp/".$this->valF['fichier'])) { |
165 |
|
$contents=file_get_contents("../tmp/".$this->valF['fichier']); |
166 |
|
// On essaye de l'enregistrer |
167 |
|
$res = $this->f->storeDecisionFile($contents, $this->valF['fichier'], |
168 |
|
$this->valF['dossier'], |
169 |
|
'consultation_'.$this->valF['consultation']."_"); |
170 |
|
// Si l'enregistrement s'est bien deroule |
171 |
|
// on supprime le fichier dans tmp |
172 |
|
// on met a jour valF avec le nouveau nom du fichier |
173 |
|
if($res===true){ |
174 |
|
$this->addToMessage(_("Sauvegarde du fichier reussi")); |
175 |
|
unlink("../tmp/".$this->valF['fichier']); |
176 |
|
$this->valF['fichier']='consultation_'.$this->valF['consultation']."_".$this->valF['fichier']; |
177 |
|
// Sinon on supprime le fichier dans tmp |
178 |
|
// on reinitialise le nom du fichier a l'ancienne valeur |
179 |
|
} else { |
180 |
|
$this->correct = false; |
181 |
|
$this->addToMessage($res); |
182 |
|
unlink("../tmp/".$this->valF['fichier']); |
183 |
|
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
184 |
|
} |
185 |
} |
} |
|
$form->setType('consultation', 'hiddenstatic'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
|
}else{ // supprimer |
|
|
$form->setType('consultation', 'hiddenstatic'); |
|
|
$form->setType('dossier', 'hiddenstatic'); |
|
186 |
} |
} |
187 |
} |
} |
188 |
|
|
189 |
|
function setType(&$form,$maj) { |
190 |
|
// Appel du parent |
191 |
|
parent::setType($form,$maj); |
192 |
|
// MODE - AJOUTER |
193 |
|
if ($maj == 0) { |
194 |
|
// On cache alors tous les champs que nous ne voulons pas voir |
195 |
|
// apparaître dans le formulaire d'ajout (principalement les |
196 |
|
// informations sur le retour d'avis) |
197 |
|
$form->setType('date_retour', 'hidden'); |
198 |
|
$form->setType('date_reception', 'hidden'); |
199 |
|
$form->setType('date_limite', 'hidden'); |
200 |
|
$form->setType('avis_consultation', 'hidden'); |
201 |
|
$form->setType('motivation', 'hidden'); |
202 |
|
$form->setType('fichier', 'hidden'); |
203 |
|
$form->setType('lu', 'hidden'); |
204 |
|
// On permet la modification de certains champs |
205 |
|
$form->setType('dossier', 'hiddenstatic'); |
206 |
|
$form->setType('service', 'select'); |
207 |
|
$form->setType('date_envoi', 'date2'); |
208 |
|
} |
209 |
|
// MODE - MODIFIER |
210 |
|
if ($maj == 1) { |
211 |
|
|
212 |
function setTaille(&$form,$maj){ |
// On affiche en statique les informations qui ne sont plus |
213 |
$form->setTaille('consultation', 8); |
// modifiables |
214 |
$form->setTaille('dossier', 12); |
$form->setType('dossier', 'hiddenstatic'); |
215 |
$form->setTaille('service', 5); |
$form->setType('date_envoi', 'hiddenstaticdate'); |
216 |
$form->setTaille('date_envoi', 12); |
$form->setType('date_limite', 'hiddenstaticdate'); |
217 |
$form->setTaille('date_retour', 12); |
$form->setType('service', 'selecthiddenstatic'); |
218 |
$form->setTaille('avis', 2); |
|
219 |
$form->setTaille('date_limite', 12); |
// La date de réception ne peut être modifiée que par un |
220 |
} |
// utilisateur en ayant spécifiquement la permission |
221 |
|
if($this->f->isAccredited('consultation_modifier_date_reception')) { |
222 |
function setMax(&$form,$maj){ |
$form->setType('date_reception', 'date2'); |
223 |
$form->setMax('consultation', 8); |
} else { |
224 |
$form->setMax('dossier', 12); |
$form->setType('date_reception', 'hiddenstaticdate'); |
225 |
$form->setMax('service', 5); |
} |
|
$form->setMax('date_envoi', 12); |
|
|
$form->setMax('date_retour', 12); |
|
|
$form->setMax('avis', 2); |
|
|
$form->setMax('date_limite', 12); |
|
|
} |
|
226 |
|
|
227 |
|
// Le marqueur lu/non lu ne peut être modifié que par un |
228 |
|
// utilisateur en ayant spécifiquement la permission |
229 |
|
if ($this->f->isAccredited('consultation_modifier_lu')) { |
230 |
|
$form->setType('lu', 'checkbox'); |
231 |
|
} else { |
232 |
|
$form->setType('lu', 'hidden'); |
233 |
|
} |
234 |
|
|
235 |
|
// Gestion du type du widget sur le champ fichier |
236 |
|
if($this->val[array_search("fichier",$this->champs)]=="" OR |
237 |
|
$this->f->isAccredited('consultation_modifier_fichier')) { |
238 |
|
// Si il n'y a jamais eu de fichier enregistré ou que |
239 |
|
// l'utilisateur a spécifiquement les droits pour modifier |
240 |
|
// un fichier déjà enregistré alors on positionne un type |
241 |
|
// de widget modifiable |
242 |
|
$form->setType('fichier', 'tmpUpload'); |
243 |
|
} else { |
244 |
|
// Si non on affiche uniquement le nom du fichier |
245 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
246 |
|
} |
247 |
|
|
248 |
|
// Modification layout : écran de retour d'avis permettant |
249 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
250 |
|
if (!$this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
251 |
|
|
252 |
|
// On cache alors tous les champs que nous ne voulons pas voir |
253 |
|
$form->setType('dossier', 'hidden'); |
254 |
|
$form->setType('service', 'hidden'); |
255 |
|
$form->setType('date_envoi', 'hidden'); |
256 |
|
$form->setType('date_retour', 'hidden'); |
257 |
|
$form->setType('date_reception', 'hidden'); |
258 |
|
$form->setType('date_limite', 'hidden'); |
259 |
|
$form->setType('lu', 'hidden'); |
260 |
|
|
261 |
|
} |
262 |
|
|
263 |
|
} |
264 |
|
// MODE - CONSULTER |
265 |
|
if ( $maj == 3 ) { |
266 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
267 |
|
} |
268 |
|
//// On cache la clé primaire |
269 |
|
//$form->setType('consultation', 'hidden'); |
270 |
|
} |
271 |
|
|
272 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// TRIGGER AVANT MODIFICATION DE DONNEES |
273 |
// trigger before modification data |
// trigger before modification data |
274 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
275 |
// mise a jour instruction avec evenement [return delay] |
// mise a jour instruction avec evenement [return delay] |
276 |
if (!$this->valF['date_envoi']==""){ |
if ($this->valF['date_envoi']!=""){ |
277 |
$sql= "select delai from service where service ='".$this->valF['service']."'"; |
$sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'"; |
278 |
$delai = $db->getOne($sql); |
$delai = $db->getOne($sql); |
279 |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
280 |
$this->msg=$this->msg."<br>"._("delai")." ". |
$this->addToMessage(_("delai")." ". |
281 |
_("retour")." ".$delai." "._("mois")." -> ". |
_("retour")." ".$delai." "._("mois")." -> ". |
282 |
_("retour")." ".$this->valF['date_limite']."<br>"; |
_("retour")." ".$this->valF['date_limite']."<br>"); |
283 |
|
$this->valF['lu'] = true; |
284 |
|
} |
285 |
|
|
286 |
|
} |
287 |
|
|
288 |
|
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
289 |
|
|
290 |
|
// Verification de la demande de notif par mail |
291 |
|
$sql= "SELECT abrege, notification_email, email FROM ".DB_PREFIXE. |
292 |
|
"service WHERE service ='".$this->valF['service']."'"; |
293 |
|
$res=$db->query($sql); |
294 |
|
$notif = $res->fetchrow(DB_FETCHMODE_ASSOC); |
295 |
|
if (database :: isError($sql))die($res->getMessage()."erreur ".$sql); |
296 |
|
if ($notif['notification_email']=='t') { |
297 |
|
|
298 |
|
// Recuperation des infos du dossier |
299 |
|
$sql= "SELECT dossier, terrain_adresse, terrain_adresse_complement, terrain_cp, terrain_ville |
300 |
|
FROM ".DB_PREFIXE."dossier WHERE dossier ='".$this->valF['dossier']."'"; |
301 |
|
$res=$db->query($sql); |
302 |
|
$dossier = $res->fetchrow(DB_FETCHMODE_ASSOC); |
303 |
|
|
304 |
|
// Definition des parametres d'envoi du mail |
305 |
|
$title=_("Consultation de services : dossier no")." ".$dossier['dossier']; |
306 |
|
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
307 |
|
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
308 |
|
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
309 |
|
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('services_consultes_lien_interne'). |
310 |
|
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
311 |
|
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('services_consultes_lien_externe'). |
312 |
|
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
313 |
|
_("Lien externe (hors VDM)")."</a>"; |
314 |
|
// Envoi du mail avec message de retour |
315 |
|
if($this->f->sendMail($title, $corps, $notif['email'])) { |
316 |
|
$this->addToMessage(_("Envoi d'un mail de notification au service")." ".$notif['abrege']); |
317 |
|
} else { |
318 |
|
$this->addToMessage(_("L'envoi du mail de notification a echoue")); |
319 |
|
} |
320 |
|
} |
321 |
|
|
322 |
|
|
323 |
|
// verification si envoi vers ERP est active |
324 |
|
if ($this->f->getParameter('option_erp') != "") { |
325 |
|
// s'il s'agit de la consultation ERP Secu, ERP Accessibilite, ou |
326 |
|
// deenvoie un |
327 |
|
// message a ERP |
328 |
|
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE. |
329 |
|
"dossier WHERE dossier = '" .$this->valF['dossier'] . "'"); |
330 |
|
$dossier_nature = $this->getFromDB("SELECT nature FROM ".DB_PREFIXE. |
331 |
|
"dossier WHERE dossier = '" . $this->valF['dossier'] . "'"); |
332 |
|
if ($dossier_erp == 't' |
333 |
|
&& substr($dossier_nature, 0, 2) == $this->f->getParameter('erp_dossier_nature_pc')) { |
334 |
|
// envoi du message "Demande d'instruction d'un dossier PC pour un ERP" |
335 |
|
if (($this->valF['service'] == $this->f->getParameter('erp_service_accessibilite') |
336 |
|
|| $this->valF['service'] == $this->f->getParameter('erp_service_securite'))) { |
337 |
|
$msgenque = new MessageEnqueuer(); |
338 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
339 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
340 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_INSTRUCTION_PC); |
341 |
|
} |
342 |
|
|
343 |
|
// envoi du message "Consultation ERP pour conformite" en cas de creation de la |
344 |
|
// consultation du service ERP Conformite |
345 |
|
if ($this->valF['service'] == $this->f->getParameter('erp_service_conformite')) { |
346 |
|
$msgenque = new MessageEnqueuer(); |
347 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
348 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
349 |
|
$msgenque->enqueueMessage($msgenque::$ERP_CONSULTATION_CONFORMITE); |
350 |
|
} |
351 |
|
} |
352 |
|
} // fin de if($this->f->getParameter('option_erp')) |
353 |
|
} |
354 |
|
|
355 |
|
/** |
356 |
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
357 |
|
* cette valeur |
358 |
|
* @param string $sql La requete sql a executer |
359 |
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
360 |
|
* l'execution s'arrete. |
361 |
|
*/ |
362 |
|
function getFromDB($sql) { |
363 |
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
364 |
|
$res = $this->db->limitquery($sql, 0, 1); |
365 |
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
366 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
367 |
|
// Si une erreur survient on die |
368 |
|
if (database::isError($res, true)) { |
369 |
|
// Appel de la methode de recuperation des erreurs |
370 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'instruction'); |
371 |
|
} |
372 |
|
// retourne la nature du dossier |
373 |
|
while ($row =& $res->fetchRow()) { |
374 |
|
return $row[0]; |
375 |
|
} |
376 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
377 |
|
return NULL; |
378 |
|
|
379 |
|
} |
380 |
|
|
381 |
|
|
382 |
|
/** |
383 |
|
* Returne la nature du dossier auquel la consultation appartient. |
384 |
|
* @param string $dossier L'identifiant du dossier |
385 |
|
* @return La nature du dossier si elle existe, sinon NULL. En cas |
386 |
|
* d'erreur de la BD, l'execution se termine. |
387 |
|
*/ |
388 |
|
function getDossierNature($dossier) { |
389 |
|
$sql = "SELECT nature FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
390 |
|
$res = $this->db->limitquery($sql, 0, 1); |
391 |
|
$this->addToLog("getDossierNature(): db->limitquery(\"".str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
392 |
|
// Si une erreur survient on die |
393 |
|
if (database::isError($res, true)) { |
394 |
|
// Appel de la methode de recuperation des erreurs |
395 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'dossier'); |
396 |
|
} |
397 |
|
// retourne la nature du dossier |
398 |
|
while ($row =& $res->fetchRow()) { |
399 |
|
return $row[0]; |
400 |
} |
} |
401 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
402 |
|
return NULL; |
403 |
} |
} |
404 |
|
|
405 |
// ============================================= |
// ============================================= |
441 |
return $annee."-".$mois."-".$jour ; |
return $annee."-".$mois."-".$jour ; |
442 |
} |
} |
443 |
|
|
444 |
|
// ============================================= |
445 |
|
// Ajout du fielset |
446 |
|
// Add fieldset |
447 |
|
// ============================================= |
448 |
|
function setLayout(&$form, $maj){ |
449 |
|
|
450 |
|
// Modification layout : écran de retour d'avis permettant |
451 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
452 |
|
if ($this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
453 |
|
|
454 |
|
//Champs sur lequel s'ouvre le fieldset |
455 |
|
$form->setBloc('dossier','D',""); |
456 |
|
$form->setFieldset('dossier','D',_('Consultation')); |
457 |
|
|
458 |
|
//Champs sur lequel se ferme le fieldset |
459 |
|
$form->setFieldset('date_envoi','F',''); |
460 |
|
$form->setBloc('date_envoi','F'); |
461 |
|
|
462 |
|
} |
463 |
|
|
464 |
|
// MODE - autre que AJOUTER alors on affiche un fieldset retour |
465 |
|
// d'avis |
466 |
|
if ($maj != 0) { |
467 |
|
|
468 |
|
//Champs sur lequel s'ouvre le fieldset |
469 |
|
$form->setBloc('date_reception','D',""); |
470 |
|
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
471 |
|
|
472 |
|
//Champs sur lequel se ferme le fieldset |
473 |
|
$form->setFieldset('lu','F',''); |
474 |
|
$form->setBloc('lu','F'); |
475 |
|
|
476 |
|
} |
477 |
|
} |
478 |
|
|
479 |
|
/** Surcharge de la methode retour afin de retourner sur la page de saisie de |
480 |
|
* code barre si besoin |
481 |
|
**/ |
482 |
|
function retour($premier = 0, $recherche = "", $tricol = "") { |
483 |
|
$params ="obj=".get_class($this); |
484 |
|
if($this->getParameter("retour")=="form") { |
485 |
|
$params .= "&idx=".$this->getParameter("idx"); |
486 |
|
$params .= "&action=3"; |
487 |
|
} |
488 |
|
$params .= "&premier=".$this->getParameter("premier"); |
489 |
|
$params .= "&tricol=".$this->getParameter("tricol"); |
490 |
|
$params .= "&recherche=".$this->getParameter("recherche"); |
491 |
|
$params .= "&selectioncol=".$this->getParameter("selectioncol"); |
492 |
|
$params .= "&advs_id=".$this->getParameter("advs_id"); |
493 |
|
$params .= "&valide=".$this->getParameter("valide"); |
494 |
|
echo "\n<a class=\"retour\" "; |
495 |
|
echo "href=\""; |
496 |
|
// |
497 |
|
|
498 |
|
if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) { |
499 |
|
echo "form.php?".$params; |
500 |
|
} elseif($this->getParameter("retour")=="avis_code_barre") { |
501 |
|
echo "../app/avis_code_barre.php"; |
502 |
|
} else { |
503 |
|
echo "tab.php?".$params; |
504 |
|
} |
505 |
|
// |
506 |
|
echo "\""; |
507 |
|
echo ">"; |
508 |
|
// |
509 |
|
echo _("Retour"); |
510 |
|
// |
511 |
|
echo "</a>\n"; |
512 |
|
} |
513 |
|
|
514 |
|
/** |
515 |
|
* Surcharge du bouton retour pour popup |
516 |
|
*/ |
517 |
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
518 |
|
$objsf, $premiersf, $tricolsf, $validation, |
519 |
|
$idx, $maj, $retour) { |
520 |
|
if($retourformulaire === "demande_avis_encours") { |
521 |
|
echo "\n<a class=\"retour\" "; |
522 |
|
echo "href=\""; |
523 |
|
echo "#"; |
524 |
|
echo "\" "; |
525 |
|
echo ">"; |
526 |
|
// |
527 |
|
echo _("Retour"); |
528 |
|
// |
529 |
|
echo "</a>\n"; |
530 |
|
} else { |
531 |
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
532 |
|
$objsf, $premiersf, $tricolsf, $validation, |
533 |
|
$idx, $maj, $retour); |
534 |
|
} |
535 |
|
} |
536 |
}// fin classe |
}// fin classe |
|
?> |
|
537 |
|
?> |