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 |
var $maj; |
|
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 |
function setvalF($val){ |
|
71 |
parent::setvalF($val); |
/** |
72 |
// cles secondaires numerique (contrainte integrite pgsql) |
* Cette méthode permet de récupérer la division d'un dossier |
73 |
if($val['avis_consultation']=='') $this->valF['avis_consultation']= null; |
*/ |
74 |
|
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 |
|
// sa division |
78 |
|
if ($this->getParameter("maj") == 1 || $this->getParameter("maj") == 2 |
79 |
|
|| $this->getParameter("maj") == 3) { |
80 |
|
// |
81 |
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
82 |
|
return NULL; |
83 |
|
} |
84 |
|
// |
85 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
86 |
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
87 |
|
// |
88 |
|
$division = $this->db->getOne($sql); |
89 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
90 |
|
database::isError($division); |
91 |
|
// |
92 |
|
return $division; |
93 |
|
} elseif ($this->getParameter("maj") == 0 |
94 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
95 |
|
|| $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')); |
$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 |
} |
} |
|
else |
|
|
if ( $maj == 1 ) |
|
|
$form->setVal("date_retour",date('d/m/Y')); |
|
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 setvalF($val) { |
141 |
|
parent::setValF($val); |
142 |
|
if($this->getParameter('maj')==0) { |
143 |
|
$this->valF["date_reception"]=$this->valF["date_envoi"]; |
144 |
|
$this->valF["lu"] = true; |
145 |
|
} |
146 |
|
|
147 |
|
// Si un retour d'avis est modifie on passe "lu" a false |
148 |
|
if($this->getParameter('maj')==1 AND ( |
149 |
|
$this->val[array_search("avis_consultation",$this->champs)] != $val["avis_consultation"] OR |
150 |
|
$this->val[array_search("date_retour",$this->champs)] != $val["date_retour"] OR |
151 |
|
$this->val[array_search("motivation",$this->champs)] != $val["motivation"] OR |
152 |
|
$this->val[array_search("fichier",$this->champs)] != $val["fichier"]) |
153 |
|
) { |
154 |
|
$this->valF["lu"]=false; |
155 |
|
} |
156 |
|
} |
157 |
|
|
158 |
|
function verifier($val, &$db, $DEBUG) { |
159 |
|
parent::verifier($val, $db, $DEBUG); |
160 |
|
// Si le fichier envoye est different de l'existant |
161 |
|
if (isset($this->val[array_search("fichier",$this->champs)]) |
162 |
|
&& $this->val[array_search("fichier",$this->champs)] != $val["fichier"] |
163 |
|
&& $this->valF['fichier']!="") { |
164 |
|
// Si le fichier existe dans tmp |
165 |
|
if(file_exists("../tmp/".$this->valF['fichier'])) { |
166 |
|
$contents=file_get_contents("../tmp/".$this->valF['fichier']); |
167 |
|
// On essaye de l'enregistrer |
168 |
|
$res = $this->f->storeDecisionFile($contents, $this->valF['fichier'], |
169 |
|
$this->valF['dossier'], |
170 |
|
'consultation_'.$this->valF['consultation']."_"); |
171 |
|
// Si l'enregistrement s'est bien deroule |
172 |
|
// on supprime le fichier dans tmp |
173 |
|
// on met a jour valF avec le nouveau nom du fichier |
174 |
|
if($res===true){ |
175 |
|
$this->addToMessage(_("Sauvegarde du fichier reussi")); |
176 |
|
unlink("../tmp/".$this->valF['fichier']); |
177 |
|
$this->valF['fichier']='consultation_'.$this->valF['consultation']."_".$this->valF['fichier']; |
178 |
|
// Sinon on supprime le fichier dans tmp |
179 |
|
// on reinitialise le nom du fichier a l'ancienne valeur |
180 |
|
} else { |
181 |
|
$this->correct = false; |
182 |
|
$this->addToMessage($res); |
183 |
|
unlink("../tmp/".$this->valF['fichier']); |
184 |
|
$this->valF['fichier']=$this->val[array_search("fichier",$this->champs)]; |
185 |
|
} |
186 |
|
} |
187 |
|
} |
188 |
|
} |
189 |
|
|
190 |
function setType(&$form,$maj) { |
function setType(&$form,$maj) { |
191 |
|
// Appel du parent |
192 |
parent::setType($form,$maj); |
parent::setType($form,$maj); |
193 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
// MODE - AJOUTER |
194 |
if($maj==0){ // add |
if ($maj == 0) { |
195 |
$form->setType('date_envoi', 'date2'); |
// On cache alors tous les champs que nous ne voulons pas voir |
196 |
$form->setType('service', 'select'); |
// apparaître dans le formulaire d'ajout (principalement les |
197 |
$form->setType('date_limite', 'hidden'); |
// informations sur le retour d'avis) |
198 |
|
$form->setType('date_retour', 'hidden'); |
199 |
|
$form->setType('date_reception', 'hidden'); |
200 |
|
$form->setType('date_limite', 'hidden'); |
201 |
|
$form->setType('avis_consultation', 'hidden'); |
202 |
|
$form->setType('motivation', 'hidden'); |
203 |
|
$form->setType('fichier', 'hidden'); |
204 |
|
$form->setType('lu', 'hidden'); |
205 |
|
// On permet la modification de certains champs |
206 |
|
$form->setType('dossier', 'hiddenstatic'); |
207 |
|
$form->setType('service', 'select'); |
208 |
|
$form->setType('date_envoi', 'date2'); |
209 |
|
} |
210 |
|
// MODE - MODIFIER |
211 |
|
if ($maj == 1) { |
212 |
|
|
213 |
|
// On affiche en statique les informations qui ne sont plus |
214 |
|
// modifiables |
215 |
|
$form->setType('dossier', 'hiddenstatic'); |
216 |
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
217 |
|
$form->setType('date_limite', 'hiddenstaticdate'); |
218 |
|
$form->setType('service', 'selecthiddenstatic'); |
219 |
|
|
220 |
|
// La date de réception ne peut être modifiée que par un |
221 |
|
// utilisateur en ayant spécifiquement la permission |
222 |
|
if($this->f->isAccredited('consultation_modifier_date_reception')) { |
223 |
|
$form->setType('date_reception', 'date2'); |
224 |
|
} else { |
225 |
|
$form->setType('date_reception', 'hiddenstaticdate'); |
226 |
|
} |
227 |
|
|
228 |
|
// Le marqueur lu/non lu ne peut être modifié que par un |
229 |
|
// utilisateur en ayant spécifiquement la permission |
230 |
|
if ($this->f->isAccredited('consultation_modifier_lu')) { |
231 |
|
$form->setType('lu', 'checkbox'); |
232 |
|
} else { |
233 |
|
$form->setType('lu', 'hidden'); |
234 |
|
} |
235 |
|
|
236 |
|
// Gestion du type du widget sur le champ fichier |
237 |
|
if($this->val[array_search("fichier",$this->champs)]=="" OR |
238 |
|
$this->f->isAccredited('consultation_modifier_fichier')) { |
239 |
|
// Si il n'y a jamais eu de fichier enregistré ou que |
240 |
|
// l'utilisateur a spécifiquement les droits pour modifier |
241 |
|
// un fichier déjà enregistré alors on positionne un type |
242 |
|
// de widget modifiable |
243 |
|
$form->setType('fichier', 'tmpUpload'); |
244 |
|
} else { |
245 |
|
// Si non on affiche uniquement le nom du fichier |
246 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
247 |
|
} |
248 |
|
|
249 |
|
// Modification layout : écran de retour d'avis permettant |
250 |
|
// uniquement la saisie des trois champs : avis, motivation et fichier |
251 |
|
if (!$this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
252 |
|
|
253 |
|
// On cache alors tous les champs que nous ne voulons pas voir |
254 |
|
$form->setType('dossier', 'hidden'); |
255 |
|
$form->setType('service', 'hidden'); |
256 |
|
$form->setType('date_envoi', 'hidden'); |
257 |
$form->setType('date_retour', 'hidden'); |
$form->setType('date_retour', 'hidden'); |
258 |
$form->setType('avis_consultation', 'hidden'); |
$form->setType('date_reception', 'hidden'); |
259 |
$form->setType('motivation', 'hidden'); |
$form->setType('date_limite', 'hidden'); |
260 |
$form->setType('fichier', 'hidden'); |
$form->setType('lu', 'hidden'); |
261 |
$form->setType('lu', 'hidden'); |
|
|
$form->setType('date_reception', 'hidden'); |
|
|
}else{ // modify |
|
|
$form->setType('date_envoi', 'hiddenstaticdate'); |
|
|
$form->setType('date_limite', 'hiddenstaticdate'); |
|
|
$form->setType('service', 'selectdisabled'); |
|
|
$form->setType('date_retour', 'date2'); |
|
|
$form->setType('avis_consultation', 'select'); |
|
|
$form->setType('motivation', 'textarea'); |
|
|
$form->setType('fichier', 'upload'); |
|
262 |
} |
} |
263 |
$form->setType('consultation', 'hiddenstatic'); |
|
264 |
$form->setType('dossier', 'hiddenstatic'); |
} |
265 |
|
// MODE - CONSULTER |
266 |
|
if ( $maj == 3 ) { |
267 |
|
$form->setType('fichier', 'tmpUploadStatic'); |
268 |
|
} |
269 |
|
//// On cache la clé primaire |
270 |
|
//$form->setType('consultation', 'hidden'); |
271 |
|
} |
272 |
|
|
273 |
|
// Cette méthode permet de calculer la date limite en fonction de la date |
274 |
|
// de réception et du délai de consultation du service consulté |
275 |
|
function calculDateLimite() { |
276 |
|
// mise a jour instruction avec evenement [return delay] |
277 |
|
if ($this->valF["date_reception"] != "") { |
278 |
|
// |
279 |
|
$sql = " select delai from ".DB_PREFIXE."service "; |
280 |
|
$sql .= " where service='".$this->valF["service"]."' "; |
281 |
|
// |
282 |
|
$delai = $this->db->getOne($sql); |
283 |
|
$this->addToLog("triggerajouter(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
284 |
|
// |
285 |
|
$this->valF["date_limite"] = $this->moisdate($this->valF["date_reception"], $delai); |
286 |
|
// |
287 |
|
$this->addToMessage(_("delai")." ". |
288 |
|
_("retour")." ".$delai." "._("mois")." -> ". |
289 |
|
_("retour")." ".date("d/m/Y", strtotime($this->valF["date_limite"]))); |
290 |
} |
} |
|
else { |
|
|
$form->setType('date_limite', 'hidden'); |
|
|
$form->setType('date_retour', 'hidden'); |
|
|
$form->setType('avis_consultation', 'hidden'); |
|
|
$form->setType('motivation', 'hidden'); |
|
|
$form->setType('fichier', 'hidden'); |
|
|
$form->setType('lu', 'hidden'); |
|
|
$form->setType('date_reception', 'hidden'); |
|
|
} |
|
291 |
} |
} |
292 |
|
|
293 |
// TRIGGER AVANT MODIFICATION DE DONNEES |
// TRIGGER AVANT MODIFICATION DE DONNEES |
294 |
// trigger before modification data |
// trigger before modification data |
295 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
296 |
// mise a jour instruction avec evenement [return delay] |
// |
297 |
if (!$this->valF['date_envoi']==""){ |
$this->calculDateLimite(); |
298 |
$sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'"; |
} |
299 |
$delai = $db->getOne($sql); |
|
300 |
$this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai); |
// |
301 |
$this->msg=$this->msg."<br>"._("delai")." ". |
function triggermodifier($id,&$db,$val,$DEBUG) { |
302 |
_("retour")." ".$delai." "._("mois")." -> ". |
// |
303 |
_("retour")." ".$this->valF['date_limite']."<br>"; |
$this->calculDateLimite(); |
304 |
$this->valF['lu'] = true; |
} |
305 |
|
|
306 |
/*require("../php/phpmailer/class.phpmailer.php"); |
// |
307 |
|
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
308 |
$mail = new PHPMailer(); |
|
309 |
|
// Verification de la demande de notif par mail |
310 |
$mail->IsSMTP(); // set mailer to use SMTP |
$sql= "SELECT abrege, libelle, notification_email, email FROM ".DB_PREFIXE. |
311 |
$mail->Host = "smtp.gmail.com"; // specify main and backup server |
"service WHERE service ='".$this->valF['service']."'"; |
312 |
$mail->SMTPAuth = true; // turn on SMTP authentication |
$res=$db->query($sql); |
313 |
$mail->Username = ""; // SMTP username |
$notif = $res->fetchrow(DB_FETCHMODE_ASSOC); |
314 |
$mail->Password = ""; // SMTP password |
if (database :: isError($sql))die($res->getMessage()."erreur ".$sql); |
315 |
|
if ($notif['notification_email']=='t') { |
316 |
$mail->From = "[email protected]"; |
|
317 |
$mail->FromName = "Mailer"; |
// Recuperation des infos du dossier |
318 |
$mail->AddAddress("[email protected]", "Vi"); |
$sql= "SELECT dossier, terrain_adresse, terrain_adresse_complement, terrain_cp, terrain_ville |
319 |
$mail->AddReplyTo("[email protected]", "Information"); |
FROM ".DB_PREFIXE."dossier WHERE dossier ='".$this->valF['dossier']."'"; |
320 |
|
$res=$db->query($sql); |
321 |
$mail->WordWrap = 50; // set word wrap to 50 characters |
$dossier = $res->fetchrow(DB_FETCHMODE_ASSOC); |
322 |
$mail->IsHTML(true); // set email format to HTML |
|
323 |
|
// Definition des parametres d'envoi du mail |
324 |
$mail->Subject = "Here is the subject"; |
$title=_("Consultation de services : dossier no")." ".$dossier['dossier']; |
325 |
$mail->Body = "This is the HTML message body <b>in bold!</b>"; |
$corps=_("Votre service est consulte concernant le dossier no")." ".$dossier['dossier']."<br/>". |
326 |
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; |
_("Il concerne le terrain situe a l'adresse :")." ".utf8_decode($dossier['terrain_adresse']). |
327 |
|
" ".utf8_decode($dossier['terrain_adresse_complement'])." ".utf8_decode($dossier['terrain_cp'])." ".$dossier['terrain_ville']."<br/>". |
328 |
if(!$mail->Send()) |
_("Vous pouvez y acceder et rendre votre avis a l'adresse")." <a href='".$this->f->getParameter('services_consultes_lien_interne'). |
329 |
{ |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
330 |
echo "Message could not be sent. <p>"; |
_("Lien interne (services VDM)")."</a> "._("ou")." <a href='".$this->f->getParameter('services_consultes_lien_externe'). |
331 |
echo "Mailer Error: " . $mail->ErrorInfo; |
"scr/form.php?obj=consultation&action=3&idx=".$this->valF['consultation']."' >". |
332 |
exit; |
_("Lien externe (hors VDM)")."</a>"; |
333 |
} |
// Envoi du mail avec message de retour |
334 |
|
if($this->f->sendMail($title, $corps, $notif['email'])) { |
335 |
echo "Message has been sent";*/ |
$this->addToMessage(_("Envoi d'un mail de notification au service")." \"(".$notif['abrege'].") ".$notif["libelle"]."\""); |
336 |
|
} else { |
337 |
|
$this->addToMessage(_("L'envoi du mail de notification a echoue")); |
338 |
|
} |
339 |
} |
} |
340 |
|
|
341 |
|
|
342 |
|
// verification si envoi vers ERP est active |
343 |
|
if ($this->f->getParameter('option_erp') != "") { |
344 |
|
// s'il s'agit de la consultation ERP Secu, ERP Accessibilite, ou |
345 |
|
// deenvoie un |
346 |
|
// message a ERP |
347 |
|
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE. |
348 |
|
"dossier WHERE dossier = '" .$this->valF['dossier'] . "'"); |
349 |
|
$dossier_nature = $this->getFromDB("SELECT dossier_autorisation_type_detaille.code FROM ".DB_PREFIXE. |
350 |
|
"dossier |
351 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation |
352 |
|
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation |
353 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
354 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille |
355 |
|
= dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
356 |
|
WHERE dossier = '" . $this->valF['dossier'] . "'"); |
357 |
|
if ($dossier_erp == 't' |
358 |
|
&& substr($dossier_nature, 0, 2) == $this->f->getParameter('erp_dossier_nature_pc')) { |
359 |
|
// envoi du message "Demande d'instruction d'un dossier PC pour un ERP" |
360 |
|
if (($this->valF['service'] == $this->f->getParameter('erp_service_accessibilite') |
361 |
|
|| $this->valF['service'] == $this->f->getParameter('erp_service_securite'))) { |
362 |
|
$msgenque = new MessageEnqueuer(); |
363 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
364 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
365 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_INSTRUCTION_PC); |
366 |
|
} |
367 |
|
|
368 |
|
// envoi du message "Consultation ERP pour conformite" en cas de creation de la |
369 |
|
// consultation du service ERP Conformite |
370 |
|
if ($this->valF['service'] == $this->f->getParameter('erp_service_conformite')) { |
371 |
|
$msgenque = new MessageEnqueuer(); |
372 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
373 |
|
$msgenque->setConsultationIdentifier($this->valF['consultation']); |
374 |
|
$msgenque->enqueueMessage($msgenque::$ERP_CONSULTATION_CONFORMITE); |
375 |
|
} |
376 |
|
} |
377 |
|
} // fin de if($this->f->getParameter('option_erp')) |
378 |
|
} |
379 |
|
|
380 |
|
/** |
381 |
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
382 |
|
* cette valeur |
383 |
|
* @param string $sql La requete sql a executer |
384 |
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
385 |
|
* l'execution s'arrete. |
386 |
|
*/ |
387 |
|
function getFromDB($sql) { |
388 |
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
389 |
|
$res = $this->db->limitquery($sql, 0, 1); |
390 |
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
391 |
|
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(), 'instruction'); |
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 |
|
|
406 |
// ============================================= |
// ============================================= |
442 |
return $annee."-".$mois."-".$jour ; |
return $annee."-".$mois."-".$jour ; |
443 |
} |
} |
444 |
|
|
445 |
// ============================================= |
// ============================================= |
446 |
// Ajout du fielset |
// Ajout du fielset |
447 |
// Add fieldset |
// Add fieldset |
448 |
// ============================================= |
// ============================================= |
449 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
450 |
if ( $maj < 2 ) { |
|
451 |
//Champs sur lequel s'ouvre le fieldset |
// Modification layout : écran de retour d'avis permettant |
452 |
$form->setBloc('dossier','D',""); |
// uniquement la saisie des trois champs : avis, motivation et fichier |
453 |
$form->setFieldset('dossier','D',_('Consultation')); |
if ($this->f->isAccredited('consultation_consulter_autre_que_retour_avis')) { |
454 |
|
|
455 |
//Champs sur lequel se ferme le fieldset |
//Champs sur lequel s'ouvre le fieldset |
456 |
$form->setFieldset('date_envoi','F',''); |
$form->setBloc('dossier','D',""); |
457 |
$form->setBloc('date_envoi','F'); |
$form->setFieldset('dossier','D',_('Consultation')); |
458 |
if ( $maj == 1 ){ |
|
459 |
//Champs sur lequel s'ouvre le fieldset |
//Champs sur lequel se ferme le fieldset |
460 |
$form->setBloc('date_reception','D',""); |
$form->setFieldset('date_envoi','F',''); |
461 |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
$form->setBloc('date_envoi','F'); |
462 |
|
|
463 |
//Champs sur lequel se ferme le fieldset |
} |
464 |
$form->setFieldset('lu','F',''); |
|
465 |
$form->setBloc('lu','F'); |
// MODE - autre que AJOUTER alors on affiche un fieldset retour |
466 |
} |
// d'avis |
467 |
} |
if ($maj != 0) { |
468 |
|
|
469 |
} |
//Champs sur lequel s'ouvre le fieldset |
470 |
|
$form->setBloc('date_reception','D',""); |
471 |
function setSelect(&$form, $maj,&$db,$debug) { |
$form->setFieldset('date_reception','D',_('Retour d\'avis')); |
472 |
parent::setSelect($form, $maj,$db,$debug); |
|
473 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
//Champs sur lequel se ferme le fieldset |
474 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
$form->setFieldset('lu','F',''); |
475 |
if($maj<2){ |
$form->setBloc('lu','F'); |
476 |
$contenu=array(); |
|
477 |
$sql = " SELECT service, abrege, libelle FROM ".DB_PREFIXE."service"; |
} |
478 |
$res = $db->query($sql); |
} |
479 |
if (database::isError($res)) |
|
480 |
die($res->getMessage()); |
/** Surcharge de la methode retour afin de retourner sur la page de saisie de |
481 |
$contenu[0][0]=""; |
* code barre si besoin |
482 |
$contenu[1][0]=_('choisir')." "._('service'); |
**/ |
483 |
$k=1; |
function retour($premier = 0, $recherche = "", $tricol = "") { |
484 |
while ($row=& $res->fetchRow()){ |
$params ="obj=".get_class($this); |
485 |
if($maj==0){ // ajouter |
if($this->getParameter("retour")=="form") { |
486 |
$contenu[0][$k]=$row[0]; |
$params .= "&idx=".$this->getParameter("idx"); |
487 |
$contenu[1][$k]=$row[1]." ".$row[2]; |
$params .= "&action=3"; |
488 |
$k++; |
} |
489 |
}else{ |
$params .= "&premier=".$this->getParameter("premier"); |
490 |
// select hiddenstatic |
$params .= "&tricol=".$this->getParameter("tricol"); |
491 |
$contenu[0][$k]=$row[0]; |
$params .= "&recherche=".$this->getParameter("recherche"); |
492 |
$contenu[1][$k]=$row[1]." ".$row[2]; |
$params .= "&selectioncol=".$this->getParameter("selectioncol"); |
493 |
$k++; |
$params .= "&advs_id=".$this->getParameter("advs_id"); |
494 |
} |
$params .= "&valide=".$this->getParameter("valide"); |
495 |
} |
echo "\n<a class=\"retour\" "; |
496 |
$form->setSelect("service",$contenu); |
echo "href=\""; |
497 |
} |
// |
498 |
} |
|
499 |
|
if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) { |
500 |
//Formatage des intitulés des champs. |
echo "form.php?".$params; |
501 |
function setLib(&$form,$maj) { |
} elseif($this->getParameter("retour")=="avis_code_barre") { |
502 |
parent::setLib($form,$maj); |
echo "../app/avis_code_barre.php"; |
503 |
$form->setLib('date_reception','date de reception'); |
} else { |
504 |
$form->setLib('avis_consultation','avis'); |
echo "tab.php?".$params; |
505 |
$form->setLib('fichier','retour d\'avis'); |
} |
506 |
} |
// |
507 |
|
echo "\""; |
508 |
|
echo ">"; |
509 |
|
// |
510 |
|
echo _("Retour"); |
511 |
|
// |
512 |
|
echo "</a>\n"; |
513 |
|
} |
514 |
|
|
515 |
|
/** |
516 |
|
* Surcharge du bouton retour pour popup |
517 |
|
*/ |
518 |
|
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
519 |
|
$objsf, $premiersf, $tricolsf, $validation, |
520 |
|
$idx, $maj, $retour) { |
521 |
|
if($retourformulaire === "demande_avis_encours") { |
522 |
|
echo "\n<a class=\"retour\" "; |
523 |
|
echo "href=\""; |
524 |
|
echo "#"; |
525 |
|
echo "\" "; |
526 |
|
echo ">"; |
527 |
|
// |
528 |
|
echo _("Retour"); |
529 |
|
// |
530 |
|
echo "</a>\n"; |
531 |
|
} else { |
532 |
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
533 |
|
$objsf, $premiersf, $tricolsf, $validation, |
534 |
|
$idx, $maj, $retour); |
535 |
|
} |
536 |
|
} |
537 |
}// fin classe |
}// fin classe |
|
?> |
|
538 |
|
?> |